PyTube音频和视频下载程序

时间:2020-11-01 17:34:42

标签: python pytube

我对此程序有疑问:

从pytube导入YouTube

while True:
url = YouTube(input("please enter your YouTube LINK : "))
type = YouTube(input("please enter yr type, audio or video : "))
video = url.streams.first().download()
audio = url.streams.filter(only_audio=True).all()
if type == video:
    print(video)
    break
elif type == audio:
    yt_obj[0].download()
    print(audio)

    break
else :
    print("pls enter audio, or, video :")

print("success")
break

我得到此味精: raise RegexMatchError(caller="regex_search", pattern=pattern) pytube.exceptions.RegexMatchError: regex_search: could not find match for (?:v=|\/)([0-9A-Za-z_-]{11}).*

1 个答案:

答案 0 :(得分:1)

type = input("please enter yr type, audio or video : ")

那应该解决它:)