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

Error: local variable 'check_cookie_url' referenced before assignment #13822

Closed
lmurgatroyd opened this issue Aug 4, 2017 · 11 comments
Closed

Error: local variable 'check_cookie_url' referenced before assignment #13822

lmurgatroyd opened this issue Aug 4, 2017 · 11 comments
Labels
bug

Comments

@lmurgatroyd
Copy link

@lmurgatroyd lmurgatroyd commented Aug 4, 2017

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.07.30.1. 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.07.30.1

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

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


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: []
[debug] Custom config: []
[debug] Command-line args: [u'https://www.youtube.com/playlist?list=WL', u'--yes-playlist', u'--password', u'PRIVATE', u'--username', u'PRIVATE', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.07.30.1
[debug] Python version 2.7.12 - Linux-4.4.0-87-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1
[debug] Proxy map: {}
[youtube:watchlater] Downloading login page
[youtube:watchlater] Looking up account info
[youtube:watchlater] Logging in
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 465, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 455, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1956, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 776, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 432, in extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 390, in initialize
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 2164, in _real_initialize
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 232, in _login
UnboundLocalError: local variable 'check_cookie_url' referenced before assignment

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.


Description of your issue, suggested solution and other information

After updating to the latest version of youtube-dl (2017.07.30.1), it appears logging in to YouTube no longer functions when downloading playlists or videos.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 4, 2017

Post the output with --dump-pages.

@jzoldak
Copy link

@jzoldak jzoldak commented Sep 5, 2017

I've also encountered this issue. Putting a breakpoint here in the _login method shows my tfa_str value is u'LOGIN_CHALLENGE', which is never handled in code. Looks like that's where the bug/assumption is.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 5, 2017

Post the output with --dump-pages.

@jzoldak
Copy link

@jzoldak jzoldak commented Sep 5, 2017

Unfortunately I fixed my account so that it's no longer in that state, so I can't --dump-pages at this point.

Here's a link to google's documentation on the "Login Challenge" feature.

For anyone looking for a workaround: sign into google, go to the security page of your account settings, look at device activity & security events, then review devices for sign-in events and approve the one of an "Unknown device" type from your IP address.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Sep 28, 2017

This occurs in one of my account with a recovery email but no 2FA setting (SMS, TOTP, Google Prompt, ...), I got the following tfa string:

[None, None, 'LOGIN_CHALLENGE', 4, None, 'INITIALIZED', None, None, 12, 7, None, None, None, None, None, None, '<hidden>@gmail.com', 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/ACnBePbY3BvTotR_VHeY8umZxC3C5mtuxQ/mo/photo.jpg', None, None, None, None, [], {'1027': ['yan••••••••@hot••••.•••.••'], '5028': []}]

On the webpage, it displays yan••••••••@hot••••.•••.•• and asks me the recovery mail.

@montanaflynn
Copy link

@montanaflynn montanaflynn commented Nov 9, 2017

@dstftw here is verbose output with --dump-pages:

Same command works locally on my mac but errors on a production linux machine.

root@private-youtube-proxy-1711487875-7tn1t:/# youtube-dl --verbose --dump-pages -j -f 18 -u "REDACTED" -p "REDACTED" "https://www.youtube.com/watch?v=6Qqcq2qlf3s"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'--dump-pages', u'-j', u'-f', u'18', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'https://www.youtube.com/watch?v=6Qqcq2qlf3s']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.11.06
[debug] Python version 2.7.3 - Linux-4.4.70+-x86_64-with-debian-7.11
[debug] exe versions: ffmpeg 3.3.3-static, ffprobe 3.3.3-static
[debug] Proxy map: {}
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 465, in main
  File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 455, in _real_main
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1985, in download
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 784, in extract_info
  File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 436, in extract
  File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 394, in initialize
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 258, in _real_initialize
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 233, in _login
UnboundLocalError: local variable 'check_cookie_url' referenced before assignment
@montanaflynn
Copy link

@montanaflynn montanaflynn commented Nov 9, 2017

Sometimes I get the error above and other times on the same machine I get this:

root@private-youtube-proxy-1711487875-7tn1t:/# youtube-dl --verbose --dump-pages -j -f 18 -u "REDACTED" -p "REDACTED" "https://www.youtube.com/watch?v=6Qqcq2qlf3s"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--dump-pages', u'-j', u'-f', u'18', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'https://www.youtube.com/watch?v=6Qqcq2qlf3s']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.11.06
[debug] Python version 2.7.3 - Linux-4.4.70+-x86_64-with-debian-7.11
[debug] exe versions: ffmpeg 3.3.3-static, ffprobe 3.3.3-static
[debug] Proxy map: {}
WARNING: Unable to login: Invalid password
ERROR: 6Qqcq2qlf3s: YouTube said: Please sign in to view this video.
Traceback (most recent call last):
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 784, in extract_info
    ie_result = ie.extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 437, in extract
    ie_result = self._real_extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1609, in _real_extract
    expected=True, video_id=video_id)
ExtractorError: 6Qqcq2qlf3s: YouTube said: Please sign in to view this video.

I am using the same command and username / password on my mac when it works.

@jikamens
Copy link

@jikamens jikamens commented Dec 4, 2017

Output of youtube-dl -u '[elided]' -p '[elided]' 'https://www.youtube.com/watch?v=xywNeumntoE' --dump-pages &> /tmp/youtube-dl-output.txt.

I don't know if my login password is embedded in this output, but just in case, I've already changed it.

youtube-dl-output.txt

@misaka00251
Copy link

@misaka00251 misaka00251 commented Dec 9, 2017

Same issue here.
Full Debug

@theblixguy
Copy link

@theblixguy theblixguy commented Dec 20, 2017

Same issue, @rg3 any updates on a fix?

@rg3
Copy link
Collaborator

@rg3 rg3 commented Dec 21, 2017

Stepped down as the maintainer years ago. Pinging @dstftw instead.

@dstftw dstftw closed this in 9a6628a Jul 4, 2018
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.

None yet
9 participants
You can’t perform that action at this time.