请求包含一个无效的参数位置参数YouTube API

发布于 2025-02-13 09:08:51 字数 953 浏览 1 评论 0 原文

大家好,我试图制作一个简单的python脚本,该脚本将返回一年内创建的所有视频,靠近ceratin latiude and Longiute,在半径1公里之内。但是,当我在查询中使用位置参数时,我会收到此错误,说请求包含一个无效的参数。任何人都知道如何修复此问题吗?

请求包含一个无效的参数。

import googleapiclient.discovery


api_service_name = "youtube"
api_version = "v3"
DEVELOPER_KEY = 'key'
# API client

youtube = googleapiclient.discovery.build(
        api_service_name, api_version, developerKey = DEVELOPER_KEY)

request = youtube.search().list(
        part="id,snippet",
        type='video',
        videoDuration='short',
        videoDefinition='high',
        publishedAfter='2012-07-05T11:10:04Z',
        publishedBefore='2013-07-05T11:10:04Z',
        location='37.42307,-122.08427',
        locationRadius='1km'

     
      
)


response = request.execute()


for item in response['items']:
    # Getting the id
    vidId = item['id']['videoId']
    # Getting stats of the video
    print("Publish date:",item ['snippet']['publishedAt'])

Hi all im trying to make a simple python script that will return all videos created in a certain year near a ceratin latiude and longiute within 1km radius. however im getting this error saying Request contains an invalid argument when i use location paramter in the query.Anybody know how to fix this?

Request contains an invalid argument.

import googleapiclient.discovery


api_service_name = "youtube"
api_version = "v3"
DEVELOPER_KEY = 'key'
# API client

youtube = googleapiclient.discovery.build(
        api_service_name, api_version, developerKey = DEVELOPER_KEY)

request = youtube.search().list(
        part="id,snippet",
        type='video',
        videoDuration='short',
        videoDefinition='high',
        publishedAfter='2012-07-05T11:10:04Z',
        publishedBefore='2013-07-05T11:10:04Z',
        location='37.42307,-122.08427',
        locationRadius='1km'

     
      
)


response = request.execute()


for item in response['items']:
    # Getting the id
    vidId = item['id']['videoId']
    # Getting stats of the video
    print("Publish date:",item ['snippet']['publishedAt'])

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文