The New York Public LibraryのAPIを使ってみる
概要 The New York Public Libraryでは、Digital Collections APIを提供しています。 http://api.repo.nypl.org/ 本記事では、このAPIの使い方の一例について説明します。 サインアップ まず以下のリンクをクリックして、サインアップを行います。 以下のようなフォームが表示されますので、必要な情報を入力します。 入力後、 Welcome to NYPL API という件名のメールが届きます。このメールの中に、 Authentication Token が記載されています。 メタデータの抽出 The New York Public Library Digital Collections APIではさまざまなendpointが提供されています。今回は以下のendpointを利用して、各アイテムのメタデータを抽出してみます。 http://api.repo.nypl.org/api/v1/items/item_details/[:id] 具体的には、以下のアイテムを例としてます。 https://digitalcollections.nypl.org/items/510d47e1-d3b0-a3d9-e040-e00a18064a99 そして、以下に示したメタデータの抽出を試みます。 以下のGoogle Colabにメタデータの抽出サンプルプログラムを作成しました。参考になりましたら幸いです。 https://colab.research.google.com/drive/1sO9plTqraPwdBF61sArlD6k6pZRpfJL8?usp=sharing 上記プログラムを実行すると、例えば以下のようなメタデータが得られます。 { } " " " " " t c d p i i o a l d t l t a e l l e c n e e I e t " c s " i : t s : f i u i " o e " e G n d K r e " " y " n : : o : j t i " " o " 1 " H m > 6 , a o 5 d n G 0 e o e s g n ( a j s C t i t o a a l r m r l i o t e : n ) c t S g 1 i a a 7 o k t 0 n a a 0 k r G i i ( u e i n : n d o d e S ) m a " I a k , D k a i k ( | i l T e h n g e o a c T m y a a ) l k : e i " 4 o , 4 f 3 | G H e a n d j e i s " , s t r u c I D ( l e g a c y ) : 7 4 7 8 7 7 | U n i v e r s a l U n i q u e I d e n t i f i e r ( U U I D ) : c e 4 b c d 9 0 - c 6 0 d - 0 1 2 f - 9 d 1 9 - 5 8 d 3 8 5 a 7 b c 3 4 " まとめ APIを利用したデータ活用の参考になりましたら幸いです。 ...