我从 Youtube 搜索列表中实现 youtube 搜索列表
但是出现这个错误
访问未配置。请使用 Google Developers Console 为您的项目激活 API
代码:-
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);