我尝试根据youtube search API来按国家对youtube进行趋势分析,我可以将图表设置为“ mostPopular”,该图表本应返回趋势分析视频的详细信息,但该方法无效,并返回了错误
from googleapiclient.discovery import build
DEVELOPER_KEY = "XXXXXXXXX"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
def youtube_search(max_results=5, order="relevance", token=None, location=None, location_radius=None,
regionCode=None):
youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY)
search_response = youtube.search().list(
type="video",
pageToken=token,
order=order,
part="id,snippet", # Part signifies the different types of data you want
chart="mostPopular",
maxResults=max_results,
location=location,
locationRadius=location_radius,
regionCode = regionCode,
).execute()
print(search_response)
youtube_search(regionCode='IE')
任何人都可以帮忙吗?
图表是Videos resource上的参数,在搜索资源上不可用。