IIIF_viewer in COJT, part of backend
Express Node.js
search_manifest.jsはEuropeanaのAPIからManifest.jsonを検索することでWeb上にあるマニフェストファイルの検索を実現している。 基本的にはこのブログにある方法でManifestファイルの検索をかけるが、いくつか変更点があるため工程を残しておく
EuropeanaのsearchAPI(エンドポイント:https://www.europeana.eu/api/v2/search.json に対して以下のパラメータでGETリクエストを送る パラメータ(パラメータの指定方法は https://pro.europeana.eu/resources/apis/search#param-query を参照のこと)
{
query=sv_dcterms_conformsTo%3A*iiif*(固定 IIIF対応コンテンツを抜き出すために必要),
theme=’次の選択肢が可能: archaelogy, art, fashion, manuscript, map, migration, music, nature, newspaper, photography, sport, ww1.’,
sort=’Example: &sort=timestamp_update+desc’,
rows=’検索件数(~100)’,
qf=title:’検索のクエリ’
wskey=’自分のAPI Key’
}
https://pro.europeana.eu/resources/apis/iiif によるとhttps://iiif.europeana.eu/presentation/’RECORD_ID’/manifest がマニフェストである。
’REORD_ID’とは1.のresponseとして得たJSONファイルのresponse.items.idに格納されているものである。
例:/9200518/ark__12148_btv1b8304309t や /9200356/BibliographicResource_3000118390149
よって例として挙げたRECORD_IDを使ってmanifestを取得すると https://iiif.europeana.eu/presentation/9200518/ark__12148_btv1b8304309t/manifest https://iiif.europeana.eu/presentation/9200356/BibliographicResource_3000118390149/manifest になる
manifest.jsonを取得したい場合、上のURLに’.json’を付ければよい
最終的に得られるmanifest.jsonは以下のものになる https://iiif.europeana.eu/presentation/9200518/ark__12148_btv1b8304309t/manifest.json https://iiif.europeana.eu/presentation/9200356/BibliographicResource_3000118390149/manifest.json
Manifestファイルに関するタイトルとディスクリプションを取得したい場合
手順1で検索をかけると、responseのJSONは配列items
のパラメータとしてdescription
とtitle
を持つことが分かる
descriptionもtitleも配列であることに注意して取得すればよい
"dcDescription": [
"Appartient à l'ensemble documentaire : FranceJp0",
"Ancienne collection Johan Willem de Sturler"
],
"title": [
"Tôkaidô gojûsan tsugi / Ill. Katsushika Hokusai東海道五十三次 / 葛飾北斎画. Japonais 381 (40)"
],
2019_07_20現在の進捗\n 1.rest_api_for_search_manifest.jsを実行するとローカル(http://localhost:3000/)のサーバーが立ち上がる\n 2.http://localhost:3000/ に対してPOSTリクエスト(パラメータはSlack参照)を投げるとManifestファイルの配列が返ってくる
※ManifestファイルをEuropeanaに問い合わせるソースコードはsearch_manifest.jsである