M
M
Mars362021-11-16 13:57:10
YouTube
Mars36, 2021-11-16 13:57:10

How to download youtube video with age limit using youtube-dl?

I use these options for youtube-dl

YDL_OPTIONS = { 'format': 'worstaudio/best', 'noplaylist': 'True', 'simulate': 'True', 'preferredquality': '192', 
                'preferredcodec': 'mp3', 'key': 'FFmpegExtractAudio', 'username': '[email protected]', 'password': 'myPassword'}

When I try to download a video, I get this
mistake

[youtube] Downloading login page
[youtube] Looking up account info
WARNING: Unable to look up account info: HTTP Error 400: Bad Request
[youtube] StZcUAPRRac: Downloading webpage
[youtube] StZcUAPRRac: Refetching age-gated info webpage
WARNING: unable to download video info webpage: HTTP Error 410: Gone
[youtube] Downloading just video StZcUAPRRac because of --no-playlist
ERROR: Sign in to confirm your age
This video may be inappropriate for some users.
Ignoring exception in command yt:
Traceback (most recent call last):
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 815, in wrapper
return func(self, *args, **kwargs)
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 836, in __extract_info
ie_result = ie.extract(url)
File "C:\Python\Python39\lib\site-packages\youtube_dl\extractor\common.py", line 534, in extract
ie_result = self._real_extract(url)
File "C:\Python\Python39\lib\site-packages\youtube_dl\extractor\youtube.py", line 1713, in _real_extract
raise ExtractorError(reason, expected=True)
youtube_dl.utils.ExtractorError: Sign in to confirm your age
This video may be inappropriate for some users.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\code\python\dbot\bot.py", line 172, in yt
info = ydl.extract_info(url, download=False)
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 808, in extract_info
return self.__extract_info(url, ie, download, extra_info, process)
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 824, in wrapper
self.report_error(compat_str(e), e.format_traceback())
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 628, in report_error
self.trouble(error_message, tb)
File "C:\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 598, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: Sign in to confirm your age
This video may be inappropriate for some users.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: Sign in to confirm your age
This video may be inappropriate for some users.

I rechecked the account data, it must be temporary, the age is indicated in the account settings. But the error does not change, even if the fields with the name and password are excluded from the options.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheAndrey7, 2021-11-16
@Mars36

youtube-dl is no longer supported. Video rockers always need to be updated to the latest version, as Google is struggling with them.
https://qna.habr.com/q/1072388

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question