ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
129.92k stars 9.8k forks source link

2 factor authentication doesn't work #32804

Open Lieta2 opened 1 month ago

Lieta2 commented 1 month ago

Checklist

Verbose log

youtube-dl -v -f 'bestvideo[height<=?1080]+bestaudio/best' --username "won't say" --password "won't say" -2 901316 $v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'bestvideo[height<=?1080]+bestaudio/best', '--username', 'PRIVATE', '--password', 'PRIVATE', '-2', '901316', 'https://youtu.be/OvO_G5Q0aUI']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2024.05.31 [21924742f] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-6.5.0-35-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg 4.4.2, ffprobe 4.4.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
WARNING: Unable to look up account info: HTTP Error 400: Bad Request
[youtube] OvO_G5Q0aUI: Downloading webpage
ERROR: Private video
Sign in if you've been granted access to this video
Traceback (most recent call last):
  File "/home/lieta/.local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in wrapper
    return func(self, *args, **kwargs)
  File "/home/lieta/.local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 959, in __extract_info
    ie_result = ie.extract(url)
  File "/home/lieta/.local/bin/youtube-dl/youtube_dl/extractor/common.py", line 571, in extract
    ie_result = self._real_extract(url)
  File "/home/lieta/.local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2219, in _real_extract
    raise ExtractorError(reason, expected=True)
youtube_dl.utils.ExtractorError: Private video
Sign in if you've been granted access to this video

Description

Downloading a private video from youtube with 2FA and code from Google Authenticator app doesn't work.

dirkf commented 1 month ago

The username/password options almost never work because sites change their login systems and/or require something like a Captcha that can't be handled in the yt-dl login framework.

Try passing cookies exported from your logged-in browser session where you can access the video.