ここでクエリを試すことができます:
https://developers.google.com/youtube/v3/docs/search/list#try-it
次のクエリは、ビデオIDのみを検索して取得する方法であると思います。
https://www.googleapis.com/youtube/v3/search?part=id&q= {NAME}&type = video&fields = items%2Fid&key = {YOUR_API_KEY}
たとえば、{NAME}がpsyの場合、この呼び出しは次のデータを返します。このデータから、アイテムの1つのvideoIdを取得できます。
{
"items": [
{
"id": {
"kind": "youtube#video",
"videoId": "9bZkp7q19f0"
}
},
{
"id": {
"kind": "youtube#video",
"videoId": "Ecw4O5KgvsU"
}
},
{
"id": {
"kind": "youtube#video",
"videoId": "o443b2rfFnY"
}
},
{
"id": {
"kind": "youtube#video",
"videoId": "WOyo7JD7hjo"
}
},
{
"id": {
"kind": "youtube#video",
"videoId": "QZmkU5Pg1sw"
}
}
]
}
Pythonクライアントライブラリに含まれている例を変更した場合:
https://developers.google.com/api-client-library/python/
あなたはこの方法でそれを行うことができます:
search_response = service.search().list(
q="google",
part="id",
type="video",
fields="items/id"
).execute()
videos = []
for search_result in search_response.get("items", []):
videos.append("%s" % (search_result["id"]["videoId"]))
print "Videos:\n", "\n".join(videos), "\n"