FileMaker で YouTube のあるチャンネルのタイトルと、概要文の一覧を JSON で入手する方法
FileMaker で情報整理を行なっていると、「とある Youtube チャンネルの再生リストの情報を JSON でほしい」時がある。
今回はそういった備忘録。
手順
Google Cloud Console で API キーを取得
Google Cloud Console にアクセス
「YouTube Data API v3」を有効化
API キーを発行








チャンネルの動画一覧を取得
チャンネルの「アップロード動画のプレイリストID」を取得し、動画情報を取得

JSON のリストを取得する。
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UPLOADS_PLAYLIST_ID&maxResults=50&key=YOUR_API_KEY
これで「最大50個」のリストが得られる。もし、50 個以上のリストがある場合は、nextPageToken が結果として返ってくる。
この nextPageToken を使ってリクエストすると、さらにリストを得ることができる。
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UPLOADS_PLAYLIST_ID&maxResults=50&pageToken=NEXT_PAGE_TOKEN&key=YOUR_API_KEY
とりあえず、サンプルを置いておく。自分自身のAPIキーを使って試してください。
エラーハンドリングや、スクリプトの最適化は行なっていない。もっと綺麗に書けるかもしれない。