问题描述
我第一次尝试为 YouTube 设置 Google apiclient
,并按照我所做的文档作为测试(没有找到 YouTube API 的具体示例):
My first attempt at setting up the Google apiclient
for YouTube and by following the docs I made this as a test (didn't find a specific example for the YouTube API):
import json
from apiclient.discovery import build
service = build('youtube', 'v3', developerKey = 'tralalala')
videos = service.videos()
request = videos.list(part = '7lCDEYXw3mM') # some video id
response = request.execute()
json.dumps(response, sort_keys = True, indent = 4)
我明白了
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "missingRequiredParameter",
"message": "No filter selected.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "No filter selected."
}
}
显然我缺少这个 filter
,但我似乎无法在文档 google-api-client-libraries.appspot.com.我的意图是通过提供其 id
来获取视频详细信息.
Obviously I'm missing this filter
, but I can't seem to find it anywhere in the docs google-api-client-libraries.appspot.com. My intent is to fetch a videos details by providing its id
.
推荐答案
您至少需要一个选择器才能列出.id"就是其中之一.您可以随时查看 YouTube API 示例 项目以供参考.这是 Python 列表用法在一个例子中.
You need at least one selector to list. 'id' is one of them. You can always check YouTube API Samples project for reference. Here's a Python list usage in one of examples.
这篇关于YouTube API v3 apiclient.errors.HttpError“未选择过滤器."- 我在哪里选择过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!