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
132.08k stars 10.02k forks source link

2-way auth to google #1336

Open Forever-Young opened 11 years ago

Forever-Young commented 11 years ago

Does youtube-dl work with 2-way authentication to google, or application-specific passwords? I tried both account password and app-specific generated password, 'unable to log in'

jaimeMF commented 11 years ago

Currently it just uses your email and password, so if you have 2-way auth enabled i don't think it will work. @Forever-Young and @AnnanFay, after you use youtube-dl with your login info, did you receive a verification code as usual?

Forever-Young commented 11 years ago

I didn't receive any verification code. I also tried account w/o 2-way auth (custom domain though), and also got an error:

$ youtube-dl -u email@mydomain :ytsubs
Type account password and press return:
[youtube:subscriptions] Logging in
WARNING: unable to log in: bad username or password
Forever-Young commented 11 years ago

I created new google account just now, and tried it, also unable to log in. Maybe I do something wrong?

jaimeMF commented 11 years ago

I can login with my account without problems and I don't think using an account with custom domain should be a problem.

Forever-Young commented 11 years ago

I tried one more time just now - custom domain and gmail w/o 2-way auth - ok. Account with 2-way auth - SMS came. Application-specific password - doesn't work.

hjbotha commented 11 years ago

It might be preferable and easier to implement application-specific password support, so that users can create a password specifically for youtube-dl to use rather than their main Google password.

The main benefits: Passwords can be easily revoked, so it's easy to take care of if compromised. Wouldn't require youtube-dl to prompt for the 2-factor authentication code.

fuadsaud commented 10 years ago

yes, yes, app specific password :) ping?

Hajitorus commented 10 years ago

I'm using two-factor auth on my google/youtube account, but don't have a phone number set up (no verifications sent to mobile). I do have the google authenticator app paired with my account, and can generate app-specific passwords, but neither of these options seem to be supported by yt-dl. Because of this, I'm unable to use :ytsubs, and am currently relying on a script that basically does for user in $sublist; do youtube-dl ytuser:$user; done.

FernandoMiguel commented 10 years ago

i'm coming from #2542 . using custom domain, 2FA account with several fallbacks (code, SMS, phone call). I cant really login has there been any progress on this topic?

FernandoMiguel commented 10 years ago

google killed today RSS, making this mater even more urgent. without 2FA, I cant login with YTDL and pull my subscriptions

source http://arstechnica.com/gadgets/2014/05/youtube-shuts-down-public-rss-feeds-of-user-subscriptions/

scottfromsf commented 7 years ago

Google 2FA seems to be working now. I don't know how long this has been the case but someone might want to close this issue.

yan12125 commented 7 years ago

Since #3534 TOTP (using the Google Authenticator app or equivalent) is supported via --twofactor. I don't use other 2FA code generation approaches. Maybe others can have a check?

mholt commented 7 years ago

Using 2FA with TOTP on my Google acount results in a 500 error (using youtube-dl 2017.06.25):

youtube-dl https://www.youtube.com/watch?v=rAUJN48IHXw --username="<email>"
Type account password and press [Return]: 
[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

After entering my password, my Android Phone asks "are you trying to log in to your Google account?" - I've tried various combinations of saying Yes and ignoring the prompt and entering the TOTP code into the terminal but all result in the 500 error. So, I don't think this is working...

paradonym commented 6 years ago
PS F:\Video\Youtube\Originals\REDACTED> youtube-dl --version
2018.06.19
PS F:\Video\Youtube\Originals\REDACTED> youtube-dl https://www.youtube.com/watch?v=U3lWVLuc6CE --username="REDACTED@gmail.com"
Type account password and press [Return]:
[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

I just tried a Youtube RED video I have access to, and the login using the official way always fails - passing an app-specific password also fails, but somehow on the message that the password isn't valid.

are you sure they collect the way using Google Authenticator? The default is the Yubikey and among the list of various phone and mobile numbers Google Authenticator is just one of many options.

AzureRaptor commented 6 years ago

I'm in the exact situation as mholt above, except my error is "400: Bad Request". The video(s) are not DRM-protected or anything special. I get the prompt on my Android phone, etc., and enter the 2FA code, but no matter what I do, it always errors out with that 400 error.

It seems like the Google Authenticator 2FA code is not being properly submitted somehow. Is there any movement on this issue?

chenrui333 commented 6 years ago

Have the exact problem.

$ youtube-dl -u "<email>"  https://www.youtube.com/watch?v=rAUJN48IHXw -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-u', u'PRIVATE', u'https://youtube.com/watch?v=rAUJN48IHXw', u'-v']
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.10.29
[debug] Python version 2.7.15 (CPython) - Darwin-18.0.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.0.2, ffprobe 4.0.2
[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 500: Internal Server Error
[youtube] rAUJN48IHXw: Downloading webpage
[youtube] rAUJN48IHXw: Downloading video info webpage
WARNING: Unable to extract video title
ERROR: This video is unavailable.
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 508, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1897, in _real_extract
    raise ExtractorError(error_message, expected=True)
ExtractorError: This video is unavailable.
dimpase commented 2 years ago

I'd have tried using an "app password", which you can generate in the 2FA settings of your Google account.