我正在使用YouTubeIt gem,尝试获取此查询返回的前6个视频:
client=YouTubeIt::Client.new
vidoes = client.videos_by(:most_viewed, region: "RU")
我不知道如何从
返回的内容中获取任何数据如果从查询中返回1,我可以获得视频的标题和网址:
video = client.video_by("UID of video here")
video.title #=> title gets returned
video.media_content[0].url #=> URL of video gets returned
非常感谢任何帮助!
答案 0 :(得分:1)
你去......
client = YouTubeIt::Client.new
response = client.videos_by(:most_viewed, region: "RU")
response.videos[0..5].each do |video|
puts "#{video.title}: #{video.media_content[0].url}"
end