访问未配置。请使用谷歌开发者控制台来激活API为您的项目YouTube的搜索列表您的、请使用、控制台、开发者

2023-09-06 04:12:47 作者:几近狂妄

我实现了从 YouTube搜索列表

但未来这个错误

访问未配置。请使用谷歌开发者控制台来激活API为您的项目

Access Not Configured. Please use Google Developers Console to activate the API for your project

code: -

youtube = new YouTube.Builder(transport,jsonFactory, new HttpRequestInitializer() 
{
    @Override
    public void initialize(HttpRequest request) throws IOException {
    }
}).setApplicationName("youtube-cmdline-search-sample").build();


String queryTerm = getInputQuery();

// Define the API request for retrieving search results.
YouTube.Search.List search = youtube.search().list("id,snippet");

// Set your developer key from the Google Developers Console for

String apiKey = ""; //i have server key and browser key
search.setKey(apiKey);
search.setQ(queryTerm);

search.setType("video");

search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
search.setMaxResults(NUMBER_OF_VIDEOS_RETURNED);

推荐答案

解决方案: -

我从这里老开发人员控制台网站创建的项目。

I created project from here old developer console site.

我以前从老开发人员控制台的网站浏览器的关键。

I used browser key from Old developer console site.