Search code examples
pythonyoutube-dl

Unable to extract uploader_id


import youtube_dl

def download_youtube_video(url):
    ydl_opts = {
        'format': 'bestvideo+bestaudio/best',
        'outtmpl': '%(title)s.%(ext)s',
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        try:
            info_dict = ydl.extract_info(url, download=True)
            video_title = info_dict.get('title', None)
            print(f"Downloaded '{video_title}' successfully!")
        except Exception as e:
            print("An error occurred during the download:")
            print(str(e))

video_url = 'https://www.youtube.com/watch?v=nWxB9yiYAgo'
download_youtube_video(video_url)

This returns: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

What am I missing here?

I tried changing the structure of the code a few times. Calling YouTube_dl with the link itself and nothing changes.


Solution

  • youtube-dl is out of date. Since YouTube tends to change pretty often, YTDL must be kept up to date, otherwise errors like this crop up.