Open chihsuanbjjh opened 4 years ago
I want to download video from youtube, and my code is below, but with this url "https://www.youtube.com/watch?v=XJGiS83eQLk" can work this url "https://www.youtube.com/watch?v=B5BgPWBZhvY" can't
youtube_url = "https://www.youtube.com/watch?v=B5BgPWBZhvY" def onComplete(stream,filepath): global file_path,filename,filedir file_path = filepath filename = os.path.basename(filepath) filedir = os.path.dirname(filepath) yt = YouTube(youtube_url) video_title = yt.title print(f'影片名稱為:{video_title}') (YouTube(youtube_url,on_complete_callback=onComplete).streams .order_by('resolution')[0] .download(filename = 'tempvideo') ) (YouTube(youtube_url).streams .filter(type = 'audio')[0] .download(filename = 'tempaudio') )
====================== HTTPError Traceback (most recent call last)
I want to download video from youtube, and my code is below, but with this url "https://www.youtube.com/watch?v=XJGiS83eQLk" can work this url "https://www.youtube.com/watch?v=B5BgPWBZhvY" can't
====================== HTTPError Traceback (most recent call last)