yt-dlc icon indicating copy to clipboard operation
yt-dlc copied to clipboard

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

Open someziggyman opened this issue 3 years ago • 6 comments

Checklist

  • [x] I'm reporting a broken site support issue
  • [x] I've verified that I'm running youtube-dlc version 2020.10.31
  • [x] I've checked that all provided URLs are alive and playable in a browser
  • [x] I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • [x] I've searched the bugtracker for similar bug reports including closed ones
  • [x] 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

someziggyman avatar Nov 17 '20 14:11 someziggyman

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...

nicolaasjan avatar Nov 17 '20 17:11 nicolaasjan

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.

someziggyman avatar Nov 17 '20 17:11 someziggyman

All MacOS versions come with Python 2.7 out of the box.

Ah..., didn't know that. Strange... So MacOS doesn't even use the latest and greatest? ;)

Guess they have to learn to live with limited functionality.

nicolaasjan avatar Nov 17 '20 18:11 nicolaasjan

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.

"You should upgrade to Python 3 as soon as you can." https://www.python.org/doc/sunset-python-2/

Seriously, don't expect support for EOL software. Some ready-to-merge PR might might get merged, yeah. The interesting question for me is, if apple even cares to back-port security fixes. Guess not.

samoht0 avatar Nov 17 '20 19:11 samoht0

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.

diegorodriguezv avatar Nov 20 '20 21:11 diegorodriguezv

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.

vxbinaca avatar Nov 22 '20 04:11 vxbinaca