YouTube API v3 apiclient.errors.HttpError “未选择过滤器".- 我在哪里选择过滤器? [英] YouTube API v3 apiclient.errors.HttpError "No filter selected." - where do I select a filter?

查看:29
本文介绍了YouTube API v3 apiclient.errors.HttpError “未选择过滤器".- 我在哪里选择过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试为 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 “未选择过滤器".- 我在哪里选择过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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