我之前已经构建了这个 YouTube 下载器,但是当我最近测试它时;它停止工作了。
from pytube import YouTube
import ffmpeg
import os
raw = 'C:\ProgramData\ytChache'
path1 = 'C:\ProgramData\ytChache\Video\\'
path2 = 'C:\ProgramData\ytChache\Audio\\'
file_type = "mp4"
if os.path.exists(path1 and path2):
boo = True
else:
boo = False
while boo:
url = str(input("Link : "))
choice = int(input('Enter 1 for Only Audio and Enter 2 For Both Audio and Video \n: '))
video = YouTube(url)
Streams = video.streams
if choice == 1:
aud = Streams.filter(only_audio=True).first().download(path2)
elif choice == 2:
resol = str(input("Resolution : ")) …Run Code Online (Sandbox Code Playgroud)