2011-12-02 70 views
4

official documentation我發現這個代碼:如何在沒有身份驗證的情況下連接到YouTube API?

YouTubeRequestSettings settings = 
    new YouTubeRequestSettings("example app", clientID, developerKey); 
YouTubeRequest request = new YouTubeRequest(settings); 

但它說If you do not specify authentication information when creating the YouTubeRequestSettings object, then you will only be able to use the YouTubeRequest object to perform operations that do not require authentication.

我不介意身份驗證,但如果我嘗試:

YouTubeRequestSettings settings = 
    new YouTubeRequestSettings("example app"); 

仍在等待替換DeveloperKey ,所以它不起作用。

如何在沒有認證的情況下創建該對象?有什麼方法可以這樣做嗎?

回答

1

你試過......

YouTubeRequestSettings settings = 
    new YouTubeRequestSettings("example app","",""); 

構造函數的字符串不爲空的/可選的,這樣你就不會實例是正確的

+0

是的,但它不工作。我發現需要開發人員密鑰!我真的不喜歡這種行爲.... – markzzz

相關問題