GData Youtube : obtaining thumbnails

早过忘川 提交于 2019-12-11 02:31:38

问题


I have a bunch of youtube VideoIDs (the alfanumeric string in the param watch/v=? of the youtube.com url) and I have to obtain the thumbnails for each video;

Now, for each videoid I make up an HTTP GET request like the following:

http://gdata.youtube.com/feeds/api/videos/VIDEOID?v=2&alt=json (s/VIDEOID/actualVideoID/)

And I parse/play around with the json returned; But this approach is quite expensive in terms of performance (everything would be running on a mobile device): is there a way to make a single HTTP connection (maybe POSTing the VideoIDs, instead of GETting them)...

Thanks Giupo


回答1:


Apparently the "q" parameter can work for multiple video id's. For example:

https://gdata.youtube.com/feeds/api/videos?q="7mSE-Iy_tFY"|"qybUFnY7Y8w"|"svC2XlPFW1g"&alt=json&fields=entry/id,entry/media:group/media:thumbnail

However note that the result can give extra videos because one of you're requested id's could be in another video's metadata. So you need to filter the results down to just those with the your original id list.

Alternatively it looks like you might be able to use a "batch request".



来源:https://stackoverflow.com/questions/6768805/gdata-youtube-obtaining-thumbnails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!