question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[YT] Fix --cookies option for Python 2.7 (works only with Python3)

See original GitHub issue

Checklist

  • I’m reporting a broken site support issue
  • I’ve verified that I’m running youtube-dlc version 2020.10.31
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

./dlctest -v -F --cookies cooktest.txt https://www.youtube.com/watch?v= XgnwCQzjau8
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'--cookies', u'cooktest.txt', u'https://www.youtube.com/watch?v= XgnwCQzjau8']
[debug] Loading archive file None
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dlc version 2020.11.11-2
[debug] Python version 2.7.16 (CPython) - Darwin-19.6.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] XgnwCQzjau8: Downloading webpage
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "./dlctest/main.py", line 19, in
File "./dlctest/youtube_dlc/init.py", line 487, in main
File "./dlctest/youtube_dlc/init.py", line 477, in _real_main
File "./dlctest/youtube_dlc/YoutubeDL.py", line 2104, in download
File "./dlctest/youtube_dlc/YoutubeDL.py", line 830, in extract_info
File "./dlctest/youtube_dlc/extractor/common.py", line 532, in extract
File "./dlctest/youtube_dlc/extractor/youtube.py", line 1865, in _real_extract
File "./dlctest/youtube_dlc/extractor/common.py", line 2866, in get_cookies File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 583, in init if input: self.load(input) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 643, in load for k, v in rawdata.items(): AttributeError: 'unicode' object has no attribute 'items'

Description

This issue was described here https://github.com/blackjack4494/yt-dlc/issues/175#issuecomment-725942303 and --cookies option now works only on Python3.

Test link: https://www.youtube.com/watch?v=XgnwCQzjau8

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
diegorodriguezvcommented, Nov 20, 2020

I would recommend to stop supporting python 2. It has caused decades of headaches to the community and we have to draw a line somewhere. For more information please see: https://python3statement.org/ https://pythonclock.org/ If enough projects drop support for python 2, pressure will add up to force stragglers to update.

1reaction
vxbinacacommented, Nov 22, 2020

Are there still systems that don’t have Python3? Why not make it so, that youtube-dlc first tries with Python3 and if that fails; only than use Python2 and throw an informative error message in case something fails? (it has never failed here with Python3) On the newest Linux systems Python2 isn’t even installed any more by default, so you have to e.g. use an alias like: alias youtube-dlc='python3 /usr/local/bin/youtube-dlc' for it to not throw the error: /usr/bin/env: ‘python’: No such file or directory I’ve seen several people with this issue on different forums…

All MacOS versions come with Python 2.7 out of the box. Installing Python 3 is another step that many new folks may find cumbersome and confusing.

Ports etc etc have python3. Let PYthon 2 die. Kill it if you have to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Question] · Issue #175 · blackjack4494/yt-dlc · GitHub
I used the cookies extension (both, the current site and all the sites option) ... [YT] Fix --cookies option for Python 2.7 (works...
Read more >
Cheat Sheet: Writing Python 2-3 compatible code
The futurize and python-modernize tools do not currently offer an option to do this automatically. If you are writing code for a new...
Read more >
Python: use cookie to login with Selenium - Stack Overflow
From what I've understood, I have to use cookies, the problem is that I can't understand how. I tried to download youtube cookies...
Read more >
PROBLEM SET 8: COOKIE JAR | SOLUTION (CS50 PYTHON)
Are You A Coding Expert? Take Our Free Quiz and Find Out: https://www.dorscodingschool.com/quiz▻ Free Discord Group: ...
Read more >
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
While you can make Python 2.5 work with Python 3, it is much easier if you only have to work with Python 2.7....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found