使用Python获取Youtube数据

2024-04-26 05:59:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在努力学习如何分析网络上的社交媒体数据,我从Youtube开始。在

from apiclient.errors import HttpError
from outh2client.tools import argparser
from apiclient.discovery import build
import pandas as pd
DEVELOPER_KEY = "AIzaSyB_F1mCrDydEbGUosnZES-NW-mg1CaOyjI"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
argparser.add_argument("--q", help="Search term", default="apple product")
argparser.add_argument("--max-results", help="Max results", default=50)
args = argparser.parse_args()
options = args

我得到了这个错误。在

^{pr2}$

我使用的是教程,但我得到了一个错误。在


Tags: fromimport网络addapidefaultyoutube错误
1条回答
网友
1楼 · 发布于 2024-04-26 05:59:08

它看起来像您导入的解析器

from outh2client.tools import argparser

已经定义了一个-q参数。您可以通过查看它的代码来检查它,或者通过执行argparser.print_help()(在您自己添加任何内容之前)来检查它。在

所以最简单的解决方法就是为你的论点选择另一个名字。在

相关文件为

https://docs.python.org/3.4/library/argparse.html#conflict-handler

通过查找该页上的“冲突”找到。在

https://github.com/google/oauth2client/blob/master/oauth2client/tools.py上定义的解析器没有-q参数。这是你的消息来源吗?我假设缺失的a是拼写错误。在

相关问题 更多 >

    热门问题