THp*_*ubs 3 ruby youtube ruby-on-rails
使用Ruby,我如何获取YouTube视频的数据?例如,我有一个像这样的视频的api url :(例如https://gdata.youtube.com/feeds/api/videos/6Dakd7EIgBE?v=2).如何使用Ruby将视图,投票,缩略图等元素提取到我的rails应用程序中?
Ruby gem从vedio获取信息.看看这个链接.https://github.com/thibaudgg/video_info
gem install video_info
video = VideoInfo.new("http://www.youtube.com/watch?v=mZqGqE0D0n4")
# video.available? => true
# video.video_id => "mZqGqE0D0n4"
# video.provider => "YouTube"
# video.title => "Cherry Bloom - King Of The Knife"
# video.description => "The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net"
# video.duration => 175 (in seconds)
# video.date => Sat Apr 12 22:25:35 UTC 2008
# video.thumbnail_small => "http://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg"
# video.thumbnail_medium => "http://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg"
# video.thumbnail_large => "http://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg"
# video.embed_url => "http://www.youtube.com/embed/mZqGqE0D0n4"
# video.embed_code => "'<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>'"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2354 次 |
| 最近记录: |