pythondiscorddiscord.pyyoutube-dlytdl

Discord.py ytdl doesn't play age-restricted videos


I made a discord.py music bot that uses youtube_dl to play audio from youtube. But when I'm trying to play the age-restricted video it gives me an error:

An error occurred: Command raised an exception: DownloadError: ERROR: Sign in to confirm your age This video may be inappropriate for some users.

Is there any solution?


Solution

  • You have to specify your username and password to download age restricted videos via command line:

    youtube-dl -u "<your_yt_login_name>" -p "<your_yt_password>" url
    

    In the embedded version of yt-dl you have to specify these options in the options dictionary. The parameters are called "username" and "password" respectively.