开发者

How to display YouTube video icon from Link

开发者 https://www.devze.com 2022-12-10 02:59 出处:网络
In my Rails app I want users 开发者_运维百科to be able to input video links from YouTube. I want to be able to display the YouTube icon for that link.

In my Rails app I want users 开发者_运维百科to be able to input video links from YouTube. I want to be able to display the YouTube icon for that link.

How can I do that?

Thanks,

Tam


You can use the Youtube data API to retrieve data about a single video. So pull the video id from the user's link, then make a request to the API to retrieve the thumbnail URL.

More information can be found in the documentation here:

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_video_entries.html

This is the link to call that returns an atom feed for a single video that includes the thumbnail URL:

http://gdata.youtube.com/feeds/api/videos/videoid

0

精彩评论

暂无评论...
验证码 换一张
取 消