如何在没有身份验证的情况下连接到YouTube API?

问题描述:

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 ,所以它不起作用。

如何在没有认证的情况下创建该对象?有什么方法可以这样做吗?

你试过......

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

构造函数的字符串不为空的/可选的,这样你就不会实例是正确的

+0

是的,但它不工作。我发现需要开发人员密钥!我真的不喜欢这种行为.... – markzzz