16
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

YouTube Data APIで動画を検索する

Posted at

結論

まず、GCPでAPIキーを発行。
例えば、APIでHIKAKINの動画を検索したい場合、

https://www.googleapis.com/youtube/v3/search?type=video&part=snippet&q=HIKAKIN&key=API_KEY

上のURLを叩くと検索結果がJSONで得られる。

若干ハマった点

最初ここを見ていて、必死に https://www.googleapis.com/youtube/v3/videos で検索を試みていたがそもそもエンドポイントが違った。

https://developers.google.com/youtube/v3/docs/search/list?hl=ja
http://kimizuka.hatenablog.com/entry/2015/06/01/000000_1

検索は https://www.googleapis.com/youtube/v3/search を叩く。
q パラメータに検索したい文字列を渡すことで検索できる。

参考

https://developers.google.com/youtube/v3/getting-started?hl=ja
https://developers.google.com/youtube/v3/docs/search/list?hl=ja
http://kimizuka.hatenablog.com/entry/2015/06/01/000000_1

16
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?