无法解决 YouTube 类/符号、YouTube 数据 API Java 示例问题 [英] Can't resolve YouTube class/symbol, YouTube Data API Java sample issue

查看:27
本文介绍了无法解决 YouTube 类/符号、YouTube 数据 API Java 示例问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行按关键字搜索示例来自 YouTube 数据 API Java 示例集合的代码.

I'm trying to execute the Search by keyword sample code from YouTube Data API Java Samples collection.

为了做到这一点,我:

  1. 在 IntelliJ IDEA 中创建了一个新项目.
  2. 下载最新的google-api-java-client-featured.zip.
  3. 通过项目结构→库→新建项目库google-api-java-client-featured中的库添加到项目中.
  4. 创建了一个类 Search.java 并复制粘贴了 示例.
  1. Created a new project in IntelliJ IDEA.
  2. Downloaded latest google-api-java-client-featured.zip.
  3. Added the libraries from the google-api-java-client-featured to the project via Project Structure → Libraries → New Project Library.
  4. Created a class Search.java and copy pasted the sample.

IDEA 无法解析 YouTube 类:

IDEA can't resolve YouTube class:

/**
 * Define a global instance of a Youtube object, which will be used
 * to make YouTube Data API requests.
 */
private static YouTube youtube;

我的问题:
我在哪里可以找到这个 YouTube 类,或者我需要做什么才能执行官方的 YouTube 数据 API Java 示例?

My question:
Where can I find this YouTube class or what have I to do in order to be able to execute the official YouTube Data API Java sample?

推荐答案

看来还有更多要下载.除了实际的 YouTube 数据 API 之外,您拥有一切.在撰写本文时,可以在 https://developers 上找到它.google.com/api-client-library/java/apis/youtube/v3.在该站点,可以选择下载 .zip 文件,或通过 MavenGradle 获取.

It appears that there is more to download. You got everything except the actual YouTube Data API. As of this writing it can be found at https://developers.google.com/api-client-library/java/apis/youtube/v3. At that site there is the option to download a .zip file, or obtain through Maven or Gradle.

我通过搜索(谷歌搜索)com.google.api.services.youtube.YouTube 类找到了它,我发现它在 Sample 中被列为导入你在上面链接的.

I found it by searching (googling) for the class com.google.api.services.youtube.YouTube, which I found listed as an import in the Sample that you linked above.

这篇关于无法解决 YouTube 类/符号、YouTube 数据 API Java 示例问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆