Youtube API v3 Search own videos by tag

2019-01-19 06:17发布

问题:

Is it possible to search videos by tags using Youtube API v3 ? I would like to search among my own videos.

回答1:

Use search method with ##tagname search string for q parameter and set type:video parameter. You can find other search operators here. Old one - tag:tangle doesn't work with new api for me. ## works fine.



回答2:

Recently tried the solution given by user 350D, but q=##{YOUR_TAG} does not appear to work with the latest YouTube API. It appears that the tag can only be retrieved when the video ID is provided as a parameter. I found that the following works for me:

First, retrieve a list of videos (returning minimal needed information, e.g. the video ID, title, and the high quality thumbnail URL):

https://www.googleapis.com/youtube/v3/search?key={YOUR API KEY}&fields=items(id(videoId),snippet(title,thumbnails(high(url))))&part=id,snippet;

Then batch the video IDs into one request to retrieve the associated tags:

https://www.googleapis.com/youtube/v3/videos?key={YOUR API KEY}&fields=items(id,snippet(tags))&part=snippet&id={videoID01,videoID02,etc};


回答3:

You can do a videos->list with with settings video ids as the ones in your playlist and iterate through them checking with tags. But searching by tags is not available in API anymore.