GData Youtube:获取缩略图

编程入门 行业动态 更新时间:2024-10-23 21:28:37
本文介绍了GData Youtube:获取缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一堆youtube VideoID(youtube网址的param watch/v =?中的字母数字字符串),我必须获取每个视频的缩略图;

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

现在,我为每个videoid组成一个HTTP GET请求,如下所示:

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

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

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

然后我解析/播放返回的json;但是这种方法在性能方面非常昂贵(一切都将在移动设备上运行):有没有办法建立单个HTTP连接(也许是发布VideoID,而不是获取它们)...

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)...

谢谢 朱波

推荐答案

显然,"q"参数可用于多个视频ID.例如:

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

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

但是请注意,由于您要求的其中一个ID可能位于另一视频的元数据中,因此结果可以提供更多的视频.因此,您需要将结果过滤为仅包含原始ID列表的结果.

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".

更多推荐

GData Youtube:获取缩略图

本文发布于:2023-06-04 19:11:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/503395.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缩略图   GData   Youtube

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!