这是来自pytube的文件extract.py中的错误。
- 转到安装软件包的位置。如果您不知道在哪里,请运行命令
pip show pytube3
它会给你这样的东西:
我们可以看到
Location: c:userstiagoanaconda3libsite-packages。
转到该位置,打开文件夹pytube和文件extract.py
在文件中,行号。306或301,您会发现
parse_qs(formats[i]["cipher"])
。如果是,则更"cipher"
改为"signatureCipher"
(确保’C’为大写)。
因此,您最初会有
cipher_url = [ parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats) ]
但这应该是
cipher_url = [ parse_qs(formats[i]["signatureCipher"]) for i, data in enumerate(formats) ]
运行以下脚本以查看其工作情况
# -*- coding: utf-8 -*-
”“”
Created on Mon Jun 15 12:21:49 2020@author: tiago
“”“
from pytube import YouTubevideo_url = /Users/tiago/Desktop/videos/”) # Path where to store the video
然后,您会看到该文件夹中下载的视频



