YouTube:获取youtube标题+图片+描述,如facebook [英] YouTube: get youtube title+ image+description like facebook
问题描述
当您将youtube链接粘贴到您现在正在做什么?时,他们如何做到这一点?然后出现在链接,youtube图片+标题+描述?他们是怎么做到的,这很难做到吗?这样做的例子很棒!
How have they done this smart thing that when you paste a youtube link in "What are you doing right now?" then there comes up in Links, youtube picture + title + description? how have they done this, and is it hard to do? Example of doing this would be great!
推荐答案
这样做的一种方法是使用Youtube Data API( http://code.google.com/apis/youtube/2.0/developers_guide_protocol_video_entries.html )。
One way of doing this is to use the Youtube Data API (http://code.google.com/apis/youtube/2.0/developers_guide_protocol_video_entries.html).
您将视频ID(视频链接)发送到api,它会返回xml / JSON中所需的所有数据格式,取决于您在网址中指定的内容。
You send the video id, which is in the link to a video, to the api, and it returns all the data you need in an xml/JSON format, depending on what you specify in the url.
示例:
如果您获得视频链接 http://www.youtube.com/watch?v=NWHfY_lvKIQ ,你可以使用此链接获取有关该视频的所有信息, http://gdata.youtube。 COM /供稿/ API /视频/ NWHfY_lvKIQ 。返回的数据包含有关视频的所有信息,包括标题,说明和缩略图。
If you were given the video link http://www.youtube.com/watch?v=NWHfY_lvKIQ, you could get all the info about the video by using this link, http://gdata.youtube.com/feeds/api/videos/NWHfY_lvKIQ. The data returned contains all the information about the video, including title, description, and a thumbnail.
这篇关于YouTube:获取youtube标题+图片+描述,如facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!