4

我一直在尝试使用 Pytube 模块,每次我使用它的 Client 属性时,它都会出现以下错误:

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    client = pytube.Client('my-app-identifier')
AttributeError: 'module' object has no attribute 'Client'
4

2 回答 2

3

首先,最新版本pytube(今天安装的pip install pytube是版本6.1.5;所以您可能应该查看该版本的 PyPI 页面。PyPI 页面上的简短文档没有说明Client该类;而是主要API 类是YouTube,如这段摘录所示:

from pytube import YouTube
yt = YouTube("http://www.youtube.com/watch?v=Ik-RsDGPI5Y")

# Once set, you can see all the codec and quality options YouTube has made
# available for the perticular video by printing videos.

pprint(yt.get_videos())

Read the Docs上的“PyTube”文档似乎是针对一个完全不相关的项目。据我所知,这个项目在 PyPI 上不可用。

于 2015-12-29T19:20:53.417 回答
3
于 2015-12-29T19:22:20.497 回答