2013-06-23 25 views
0

我寫了一些基本代碼來嘗試使庫運行。我在Windows 7上運行,我剛剛安裝了youtube_it gem並試圖運行自述文件中的一些示例代碼,但是,我收到了令人費解的ArgumentError。下面是我試圖運行代碼:Youtube_It示例代碼繪製參數錯誤

#Test YouTube Ruby file. 
require 'youtube_it' 
client = YouTubeIt::Client.new(:dev_key => "my developer key here) 
client.videos_by(:query => "penguin", :max_results => 1) 
client.videos.each do |video| 
    video.title 
    video.video_id 
end 

For reference, the error received was this: C:/RailsInstaller/Ruby1.9.3/lib/rubygems/1.9.1/gems/youtube_it-2.3.1/lib/youtube_it/request/video_upload.rb:265: in 'videos' wrong number of arguments (0 for 1) (ArgumentError).

任何輸入,我怎麼能去有關解決這將是巨大的。

回答

3

首先,您需要關閉您的開發重點引述

client = YouTubeIt::Client.new(:dev_key => "my developer key here")

這爲我工作:

require 'youtube_it' 
client = YouTubeIt::Client.new(:dev_key => "my developer key here") 
response = client.videos_by(:query => "penguin") 
response.videos.first.title 

從那裏試試:

response.videos.each do |video| 
    puts video.title 
end 

結果:

Pablo Penguin 
Emperor penguins - The Greatest Wildlife Show on Earth - BBC 
Penguin Fail - Best Bloopers from Penguins Spy in the Huddle 
PoM - The Penguin Who Loved Me part 1 
Scamper the Penguin (1988) - English Dubbed 
Pet Penguin in Japan 
Avicii - Penguin (Original mix) 
CLUB PENGUIN.... 
penguin 
Penguins very funny 
Emperor Penguins in Antarctica 
Christina Perri - Penguin (Official Lyric Video) 
Club Penguin Unlock Item Codes (NEW) March 2013 Must Watch !!!! (HD) 
Emperor Penguins Speed Launch Out of the Water 
Avicii - 'Penguin' (Club Mix) 
Cookie the Little Penguin at the Cincinnati Zoo 
Penguin.avi 
DONALD´S PENGUIN 1939 
Penguins - BBC 
Penguin Dilemma 
Very happy Gentoo penguin 
Zombie in a Penguin Suit 
Penguin One 
What should we expect in the next few months in terms of SEO for Google? 
槇原敬之 - PENGUIN (2004年 日本武道館) 
+0

剛剛發現這一點。謝謝,不過。 – Louis93

+0

不客氣:) – goma