Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YouTube] Unable to authenticate with enabled TFA #15184

Open
fixator10 opened this issue Jan 6, 2018 · 30 comments · May be fixed by #18521
Open

[YouTube] Unable to authenticate with enabled TFA #15184

fixator10 opened this issue Jan 6, 2018 · 30 comments · May be fixed by #18521

Comments

@fixator10
Copy link

@fixator10 fixator10 commented Jan 6, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.12.31. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.12.31
D:\downloaded_audio
λ youtube-dl --version
2017.12.31

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: ['-x', '--audio-format', 'mp3', '--audio-quality', '0']
[debug] Custom config: []
[debug] Command-line args: ['-n', '-v', 'https://www.youtube.com/watch?v=tM8x5Zhe5O0']
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2017.12.31
[debug] Python version 3.6.3 - Windows-10-10.0.16299-SP0
[debug] exe versions: ffmpeg N-88355-g05beee44c6, ffprobe N-88355-g05beee44c6
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 400: Bad Request
WARNING: Unable to extract CheckCookie URL
[youtube] tM8x5Zhe5O0: Downloading webpage
[youtube] tM8x5Zhe5O0: Downloading video info webpage
ERROR: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.
Traceback (most recent call last):
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 784, in extract_info
    ie_result = ie.extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\common.py", line 438, in extract
    ie_result = self._real_extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1609, in _real_extract
    expected=True, video_id=video_id)
youtube_dl.utils.ExtractorError: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.
[debug] System config: []
[debug] User config: ['-x', '--audio-format', 'mp3', '--audio-quality', '0']
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-v', 'https://www.youtube.com/watch?v=tM8x5Zhe5O0']
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2017.12.31
[debug] Python version 3.6.3 - Windows-10-10.0.16299-SP0
[debug] exe versions: ffmpeg N-88355-g05beee44c6, ffprobe N-88355-g05beee44c6
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 400: Bad Request
WARNING: Unable to extract CheckCookie URL
[youtube] tM8x5Zhe5O0: Downloading webpage
[youtube] tM8x5Zhe5O0: Downloading video info webpage
ERROR: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.
Traceback (most recent call last):
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 784, in extract_info
    ie_result = ie.extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\common.py", line 438, in extract
    ie_result = self._real_extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1609, in _real_extract
    expected=True, video_id=video_id)
youtube_dl.utils.ExtractorError: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.
[debug] System config: []
[debug] User config: ['-x', '--audio-format', 'mp3', '--audio-quality', '0']
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', '-2', '123456', '-v', 'https://www.youtube.com/watch?v=tM8x5Zhe5O0']
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2017.12.31
[debug] Python version 3.6.3 - Windows-10-10.0.16299-SP0
[debug] exe versions: ffmpeg N-88355-g05beee44c6, ffprobe N-88355-g05beee44c6
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
[youtube] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 400: Bad Request
WARNING: Unable to extract CheckCookie URL
[youtube] tM8x5Zhe5O0: Downloading webpage
[youtube] tM8x5Zhe5O0: Downloading video info webpage
ERROR: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.
Traceback (most recent call last):
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 784, in extract_info
    ie_result = ie.extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\common.py", line 438, in extract
    ie_result = self._real_extract(url)
  File "d:\program files\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1609, in _real_extract
    expected=True, video_id=video_id)
youtube_dl.utils.ExtractorError: tM8x5Zhe5O0: YouTube said: Please sign in to view this video.

Description of your issue, suggested solution and other information

Unable to authenticate with enabled TFA on account.
Returns HTTP Error 400 after typing 2-step verification code.
Happens in any way of authentication: .netrc, direct passing login+pass via cmd args, direct passing login+pass+tfacode via cmd args.

@rmanly
Copy link

@rmanly rmanly commented Jan 10, 2018

Found the same issue just now when attempting to grab my Watch Later for a flight.

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-i', u'-f', u'bestvideo[ext=mp4]+bestaudio[ext=m4a]', u'--restrict-filenames', u'-u', u'PRIVATE', u'-2', u'397635', u'-o', u'/Users/ryan/Downloads/later/%(title)s.%(ext)s', u'https://www.youtube.com/playlist?list=WL']
Type account password and press [Return]: 
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.01.07
[debug] Python version 2.7.10 (CPython) - Darwin-17.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.3-tessus, ffprobe 3.3.3-tessus, phantomjs 2.1.1
[debug] Proxy map: {}
[youtube:watchlater] Downloading login page
[youtube:watchlater] Looking up account info
[youtube:watchlater] Logging in
[youtube:watchlater] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
WARNING: Unable to extract CheckCookie URL
[youtube:watchlater] WL: Downloading webpage
ERROR: This playlist does not exist.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 784, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 438, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2737, in _real_extract
    _, playlist = self._extract_playlist('WL')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2259, in _extract_playlist
    raise ExtractorError(message, expected=True)
ExtractorError: This playlist does not exist.

EDIT: updated to current and re-ran

@iGoreSchmidt
Copy link

@iGoreSchmidt iGoreSchmidt commented May 21, 2018

Same *it here. Looks like cookie was expired and app tried to login back, but can't get thru TFA

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-s', u'--verbose', u':ytwatchlater', u'--ignore-config', u'-u', u'PRIVATE', u'--dump-pages']
Type account password and press [Return]: 
[debug] Encodings: locale UTF-8, fs utf-8, out None, pref UTF-8
[debug] youtube-dl version 2018.05.18
[debug] Python version 2.7.15 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: avconv 12.3, avprobe 12.3, ffmpeg 4.0, ffprobe 4.0, rtmpdump 2.4
[debug] Proxy map: {}
Type 2-step verification code and press [Return]: 
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
ERROR: This playlist does not exist.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 503, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2776, in _real_extract
    _, playlist = self._extract_playlist('WL')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2291, in _extract_playlist
    raise ExtractorError(message, expected=True)
ExtractorError: This playlist does not exist.

Just for sure with Python 3.x.x

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-s', '--verbose', ':ytwatchlater', '--ignore-config', '-u', 'PRIVATE', '--dump-pages']
Type account password and press [Return]: 
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.05.18
[debug] Python version 3.6.5 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: avconv 12.3, avprobe 12.3, ffmpeg 4.0, ffprobe 4.0, rtmpdump 2.4
[debug] Proxy map: {}
Type 2-step verification code and press [Return]: 
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
ERROR: This playlist does not exist.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 503, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2776, in _real_extract
    _, playlist = self._extract_playlist('WL')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2291, in _extract_playlist
    raise ExtractorError(message, expected=True)
youtube_dl.utils.ExtractorError: This playlist does not exist.

--dump-pages here

@reidcooper
Copy link

@reidcooper reidcooper commented Jun 4, 2018

Receiving same error with Python 2.7.x

[debug] System config: []
[debug] User config: [u'-x', u'--audio-format', u'm4a', u'-o', u'~/Desktop/%(playlist_title)s/%(title)s.%(ext)s']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'https://www.youtube.com/playlist?list=WL']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.06.04
[debug] Python version 2.7.10 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.3, ffprobe 3.3.3, phantomjs 2.1.1
[debug] Proxy map: {}
[youtube:watchlater] Downloading login page
[youtube:watchlater] Looking up account info
[youtube:watchlater] Logging in
Type 2-step verification code and press [Return]:
[youtube:watchlater] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
[youtube:watchlater] WL: Downloading webpage
ERROR: This playlist does not exist.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 500, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2790, in _real_extract
    _, playlist = self._extract_playlist('WL')
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2305, in _extract_playlist
    raise ExtractorError(message, expected=True)
ExtractorError: This playlist does not exist.
@cudek
Copy link

@cudek cudek commented Oct 9, 2018

I have the same issue on Windows 7 - error 400 when trying to pass verfication code:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ffmpeg-location', 'D:\\Home\\libs\\win64\\usr\\bin', '--extract-audio', '--audio-format', 'mp3', 'https://www.youtube.com/playlist?list=PLaS6qLljihnAKQ-zNx4xcHmB0iVm9oV2x', '-o%(title)s.%(ext)s', '--add-metadata', '--username', 'PRIVATE', '--verbose']
[debug] Encodings: locale cp1250, fs mbcs, out cp1250, pref cp1250
[debug] youtube-dl version 2018.10.05
[debug] Python version 3.4.4 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: avconv 11.3, avprobe 11.3
[debug] Proxy map: {}
[youtube:playlist] Downloading login page
[youtube:playlist] Looking up account info
[youtube:playlist] Logging in
[youtube:playlist] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 400: Bad Request
[youtube:playlist] PLaS6qLljihnAKQ-zNx4xcHmB0iVm9oV2x: Downloading webpage
ERROR: This playlist is private, use --username or --netrc to access it.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\YoutubeDL.py", line 792, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 507, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\youtube.py", line 2414, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\youtube.py", line 2337, in _extract_playlist
youtube_dl.utils.ExtractorError: This playlist is private, use --username or --netrc to access it.
@Vulp35
Copy link

@Vulp35 Vulp35 commented Dec 9, 2018

Also having this issue. Using the Authenticator App for codes
Even on latest version 2018.12.09
If turn off 2fa on my account it works just fine.

C:\youtube-dl>youtube-dl --version
2018.12.09

C:\youtube-dl>youtube-dl -v --config-location "C:\youtube-dl\1080-standard.conf"
[debug] System config: []
[debug] User config: []
[debug] Custom config: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'--no-playlist', u'-f', u'137+bestaudio/best', u'-o', u'%(series)s/Season 0%(season_number)s/Episode 0%(episode_number)s/%(title)s.%(ext)s', u'--write-thumbnail', u'--write-description', u'--mark-watched', u'--no-call-home', u'--reject-title', u'Free Preview', u'-s', u'-a', u'redplaylists.txt', u'--embed-thumbnail', u'--add-metadata']
[debug] Command-line args: [u'-v', u'--config-location', u'C:\\youtube-dl\\1080-standard.conf']
[debug] Batch file urls: [u'https://www.youtube.com/playlist?list=PLZRRxQcaEjA7LX19uAySGlc9hmprBxfEP', u'https://www.youtube.com/playlist?list=PLmosFzxUfkqUcZ-IsKJ7ZjJPQpiJvvu24', u'https://www.youtube.com/playlist?list=PLxm--8AYWEDelTYpYi2zulMEw-0T-M5IH', u'https://www.youtube.com/playlist?list=PLINwjXK120_JpGB6mRJ0oJxOdFGjxekIp']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.12.09
[debug] Python version 2.7.14 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg 3.4.1, ffprobe 3.4.1
[debug] Proxy map: {}
[youtube:playlist] Downloading login page
[youtube:playlist] Looking up account info
[youtube:playlist] Logging in
Type 2-step verification code and press [Return]:
[youtube:playlist] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
[youtube:playlist] PLZRRxQcaEjA7LX19uAySGlc9hmprBxfEP: Downloading webpage
[download] Downloading playlist: Mind Field : Season 3
[youtube:playlist] playlist Mind Field : Season 3: Downloading 2 videos
[download] Downloading video 1 of 2
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 13, 2018

@Vulp35 I'm working on a fix. What 2FA methods (Authenticator code, texted code, prompt in Google/Gmail app) do you have turned on on your Google account? Which one is the default, the one it asks for when you try to log in with a browser (use incognito if you don't know)?

@sandalle
Copy link

@sandalle sandalle commented Dec 13, 2018

@eduardog3000 , for mine, my YouTube 2FA is via Google Authenticator.

Enter a verification code
Get a verification code from the Google Authenticator app
Enter the 6-digit code
@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 13, 2018

@sandalle What error do you get when you try to log in with youtube-dl? HTTP Error 500: Internal Server Error or HTTP Error 400: Bad Request.

Then can you download this branch and tell me what happens when you try to log in (use python -m youtube_dl -v <args> to run directly from the code).

@sandalle
Copy link

@sandalle sandalle commented Dec 13, 2018

@eduardog3000

$ youtube-dl --version
2018.12.09
$ youtube-dl -u someemail@email.com -2 https://www.youtube.com/watch?v=UcRZQL-grSs
Type account password and press [Return]:
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.
$ youtube-dl -u someemail@email.com -p -2 https://www.youtube.com/watch?v=UcRZQL-grSs
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
WARNING: Unable to login: Invalid password
[youtube] UcRZQL-grSs: Downloading webpage
[youtube] UcRZQL-grSs: Downloading video info webpage
^C
ERROR: Interrupted by user

I'm unsure why those aren't working, but using my ~/.netrc values worked in that I got HTTP Error 500 for 2FA:

$ youtube-dl -n https://www.youtube.com/watch?v=UcRZQL-grSs
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Submitting TFA code
WARNING: Unable to submit TFA code: HTTP Error 500: Internal Server Error
[youtube] UcRZQL-grSs: Downloading webpage
[youtube] UcRZQL-grSs: Downloading video info webpage
[download] Destination: The Diver's Grave _ Critical Role _ Campaign 2, Episode 44-UcRZQL-grSs.mp4
[download]   0.1% of 920.30MiB at 814.70KiB/s ETA 19:16^C
ERROR: Interrupted by user

I've cloned git@github.com:eduardog3000/youtube-dl.git seems to work with 2FA. :)

$ git checkout -b tfa-fix origin/tfa-fix
Branch 'tfa-fix' set up to track remote branch 'tfa-fix' from 'origin'.
Switched to a new branch 'tfa-fix'
$ python -m youtube_dl --version
2018.12.09
$ python -m youtube_dl -v -n https://www.youtube.com/watch?v=UcRZQL-grSs
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-n', u'https://www.youtube.com/watch?v=UcRZQL-grSs']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.12.09
[debug] Git HEAD: 40217df7e
[debug] Python version 2.7.15 (CPython) - Darwin-18.2.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Selecting TOTP TFA challenge
[youtube] Submitting TFA code
[youtube] Checking cookie
[youtube] UcRZQL-grSs: Downloading webpage
[youtube] UcRZQL-grSs: Downloading video info webpage
[debug] Default format spec: best/bestvideo+bestaudio
[debug] Invoking downloader on u'somelongURL'
[download] Resuming download at byte 6225101
[download] Destination: The Diver's Grave _ Critical Role _ Campaign 2, Episode 44-UcRZQL-grSs.mp4
[download]   1.1% of 920.30MiB at 275.75KiB/s ETA 56:21^C
ERROR: Interrupted by user

I also tried downloading a playlist, and the first item worked with 2FA and the second continued to work with the 2FA session. :)

[youtube] Checking cookie
[youtube] YW01AC2NJAc: Downloading webpage
[youtube] YW01AC2NJAc: Downloading video info webpage
[youtube] YW01AC2NJAc: Marking watched
@rautamiekka
Copy link

@rautamiekka rautamiekka commented Dec 13, 2018

If I were you I'd mask your logins.

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 13, 2018

@sandalle

$ youtube-dl -u sandalle@gmail.com -p -2 https://www.youtube.com/watch?v=UcRZQL-grSs
is because you have the syntax wrong, you have to put your 6 digit TOTP code after -2.

But it's good to see my code works for you. Just to be sure, this is the very first screen you see after inputting your password in a normal browser?

image

Not something like this:

image

@sandalle
Copy link

@sandalle sandalle commented Dec 13, 2018

@sandalle
But it's good to see my code works for you. Just to be sure, this is the very first screen you see after inputting your password in a normal browser?

Correct, that's what I see after using a browser in Privacy mode.

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 14, 2018

@sandalle Thank you. Now I need someone who gets the HTTP Error 400: Bad Request (and probably should have the app prompt as their default method) to make sure I fixed that too.

Once I confirm that I should be ready to submit a PR.

@Vulp35
Copy link

@Vulp35 Vulp35 commented Dec 14, 2018

@Vulp35 I'm working on a fix. What 2FA methods (Authenticator code, texted code, prompt in Google/Gmail app) do you have turned on on your Google account? Which one is the default, the one it asks for when you try to log in with a browser (use incognito if you don't know)?

screenshot_2018-12-13 2-step verification

I can add prompt as well if that helps you.

Also, can confirm this fix is working with the Authenticator App 😃

C:\youtube-dl\youtube-dl-tfa-fix>python -m youtube_dl --version
2018.12.09

C:\youtube-dl\youtube-dl-tfa-fix>python -m youtube_dl -v --config-location "C:\youtube-dl\login.conf" https://www.youtube.com/watch?v=8mz5sCAvDAY
[debug] System config: []
[debug] User config: []
[debug] Custom config: [u'-u', u'PRIVATE', u'-p', u'PRIVATE']
[debug] Command-line args: [u'-v', u'--config-location', u'C:\\youtube-dl\\login.conf', u'https://www.youtube.com/watch?v=8mz5sCAvDAY']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.12.09
[debug] Python version 2.7.14 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg 3.4.1, ffprobe 3.4.1
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
Type 2-step verification code and press [Return]:
[youtube] Selecting TOTP TFA challenge
[youtube] Submitting TFA code
[youtube] Checking cookie
[youtube] 8mz5sCAvDAY: Downloading webpage
[youtube] 8mz5sCAvDAY: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 14, 2018

Oh, good, Prompt started working for me (you can see in my image above I got locked out of it), so I could test it myself.

Looks like all is good, I'll submit the PR.

@eduardog3000 eduardog3000 linked a pull request that will close this issue Dec 14, 2018
5 of 9 tasks complete
@Vulp35
Copy link

@Vulp35 Vulp35 commented Dec 14, 2018

Oh, good, Prompt started working for me (you can see in my image above I got locked out of it), so I could test it myself.

Anything special I have to do for prompt? I accepted then hit enter but that didn't seem to work?

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Dec 14, 2018

@Vulp35 youtube-dl can't actually use the prompt, it still needs the Google Authenticator code, but I wanted to make sure that someone with the prompt enabled was still able to use the code through youtube-dl. The way the fix works I wasn't completely sure it would work when Google asks for the prompt by default.

@Vulp35
Copy link

@Vulp35 Vulp35 commented Dec 14, 2018

@eduardog3000 oh gotcha! Yup can also confirm it working with prompt enabled as the default but using a code from Authenticator in youtube-dl

@ayancey
Copy link

@ayancey ayancey commented Jan 31, 2019

I think I am running into this because my YubiKey is my default authenticator.

@uruiamme
Copy link

@uruiamme uruiamme commented Feb 12, 2019

I am having the same difficulty with the version 2018.11.23 and the forked version that was modified by @eduardog3000 . This was difficult to test on Windows without an executable, but I figured it out. In any case, when I temporarily disable 2FA on my account, both the stock and modified versions worked for me. So I am not sure what the fix was supposed to do, but I saw no change in behavior.

[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
WARNING: Unable to log in: HTTP Error 400: Bad Request
@briansmithbeta
Copy link

@briansmithbeta briansmithbeta commented Feb 13, 2019

I'm still having this issue in version 2019.02.08. I use SMS messages as my TFA method.

Version proof:

.\youtube-dl.exe --version
2019.02.08

Debug output on Windows:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [':ytwatchlater', '-i', '--get-id', '-v', '-r', '4.2M', '--username', 'PRIVATE', '-p', 'PRIVATE']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2019.02.08
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg N-80386-g5f5a97d, ffprobe N-80386-g5f5a97d
[debug] Proxy map: {}
Type 2-step verification code and press [Return]:
WARNING: Unable to submit TFA code: HTTP Error 400: Bad Request
ERROR: This playlist does not exist.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp6w61832c\build\youtube_dl\YoutubeDL.py", line 794, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp6w61832c\build\youtube_dl\extractor\common.py", line 508, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp6w61832c\build\youtube_dl\extractor\youtube.py", line 2923, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp6w61832c\build\youtube_dl\extractor\youtube.py", line 2435, in _extract_playlist
youtube_dl.utils.ExtractorError: This playlist does not exist.

Side note:
First, I was unable to log in using an App Password, which should bypass TFA. This comment on #5280 led me to attempt to login using my regular password and TFA instead (not my preference, but I was willing to try it as a workaround). But that's failing too, which led me to this ticket.
It seems like both App Passwords and TFA are broken in version 2019.02.08. Can someone familiar with how to correctly use youtube-dl with an App Password confirm/debunk that? If both are broken, that makes it very difficult to get private playlists of any kind.

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Feb 13, 2019

@uruiamme Which version is that log from? My fork might be broken for reasons other than TFA because it is a fork of an old version. The newest official version still doesn't work with TFA because no fix has been merged in.

This branch is both the newest youtube-dl version, and has my fix applied. It should work for you and anyone who has TOTP TFA enabled. If not, post the log from it.

@uruiamme
Copy link

@uruiamme uruiamme commented Feb 14, 2019

@eduardog3000 I had followed your link to https://github.com/eduardog3000/youtube-dl/tree/tfa-fix
but you just gave this new link:
https://github.com/eduardog3000/youtube-dl/commits/tfa-fix-2019

So my test found out that both 2018.11.23 (stock) and yours based on 2018.11.23 were both still not working. I have not tried the new one. Why would the new one work? Did your fix change anything or did the main trunk make changes to TFA problems?

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Feb 14, 2019

@uruiamme 2018.11.23 stock is old and doesn't work anymore for reasons unrelated to TFA. YouTube changes things a lot, and youtube-dl has to keep up. My version based on 2018.11.23 doesn't work for the same reason.

The new branch is based on the latest commit to this main repo, so it should work where 2018.11.23 doesn't. But if YouTube has changed anything about TFA since then, my fix might not work no matter the base version.

Try my tfa-fix-2019 branch, if it doesn't work, paste the error log.

@FranciscoPombal
Copy link

@FranciscoPombal FranciscoPombal commented Feb 25, 2019

@dstftw @remitamine
I apologize for possibly tagging excessively, but 2FA on Youtube has been broken for months, yet a working fix has existed for almost as long.

Can you at least say what the current blockers are for merging the fix? The latest PR was simply locked with no further feedback given.

Links:

@eduardog3000 just curious, why create a new branch instead of rebasing the old one?

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Feb 25, 2019

@FranciscoPombal as a quick fix for the person who was asking me about it here. If the maintainers are willing to merge my code I'd happily get it all sorted. Although the code in my PR, while based on an old upstream commit, can still be merged without conflict.

@LoneFenris
Copy link

@LoneFenris LoneFenris commented Apr 26, 2019

Is there some lingering issue with the PR that's preventing merge?

@eduardog3000
Copy link

@eduardog3000 eduardog3000 commented Apr 26, 2019

@LoneFenris There was an issue, I fixed it, then the collaborator never responded and eventually locked the conversation.

@eduardog3000 eduardog3000 mentioned this issue Apr 28, 2019
5 of 9 tasks complete
@raffaem
Copy link

@raffaem raffaem commented Oct 30, 2019

Still having this issue with youtube-dl version 2019.10.29

@LoneFenris
Copy link

@LoneFenris LoneFenris commented Oct 30, 2019

@raffaem From the conversation on the associated PR, it appears there may be two issues with it:

  1. There is a concern that having TFA support could cause ytdl to overflow the number of TFA challenges Google allows in a time period

  2. There is a suggested improvement to how the PR responds to challenges that is yet to be implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

You can’t perform that action at this time.