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

instgram cookies cause youtube-dl cookie file to broken #24299

Closed
EhsanCh opened this issue Mar 9, 2020 · 5 comments
Closed

instgram cookies cause youtube-dl cookie file to broken #24299

EhsanCh opened this issue Mar 9, 2020 · 5 comments
Labels

Comments

@EhsanCh
Copy link

@EhsanCh EhsanCh commented Mar 9, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.03.08
  • 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

[debug] System config: [u'-4', u'--cookies', u'/home/youtube-cookie.txt']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.instagram.com/p/B9g4ilHJOv7/']
/usr/lib64/python2.7/_MozillaCookieJar.py:109: UserWarning: cookielib bug!
Traceback (most recent call last):
  File "/usr/lib64/python2.7/_MozillaCookieJar.py", line 71, in _really_load
    line.split("\t")
ValueError: too many values to unpack

  _warn_unhandled_exception()
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/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 474, in main
  File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 441, in _real_main
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 419, in __init__
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2329, in _setup_opener
  File "/usr/bin/youtube-dl/youtube_dl/utils.py", line 2762, in load
  File "/usr/lib64/python2.7/_MozillaCookieJar.py", line 111, in _really_load
    (filename, line))
cookielib.LoadError: invalid Netscape format cookies file u'/home/youtube-cookie.txt': u'.instagram.com\tTRUE\t/\tTRUE\t0\turlgen\t"{\\"45.12.3.45\\":\t24940}:1jBJ5c:yMVdw1trErKtMZlJkGK3zfvFI4U"'

Description

When downloading instagram video, it sent a cookie like :
"{\"45.12.3.45\": 24940}:1jBJ5c:yMVdw1trErKtMZlJkGK3zfvFI4U"
and write a line in cookie file:
.instagram.com TRUE / TRUE 0 urlgen "{\"45.12.3.45\": 24940}:1jBJ5c:yMVdw1trErKtMZlJkGK3zfvFI4U"
causing cookie file to be invalid for next youtube-dl run.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2020

Malformed cookie file. Cookie value is not allowed to contain spaces.

@dstftw dstftw closed this Mar 9, 2020
@dstftw dstftw added the invalid label Mar 9, 2020
@kruug
Copy link

@kruug kruug commented Mar 9, 2020

Used this tool: https://github.com/lennonhill/cookies-txt

Now you're telling me that the tool to export a Netscape Compatible cookie file isn't exporting a Netscape cookie file? It seems like shoddy dev work on your team...

@EhsanCh
Copy link
Author

@EhsanCh EhsanCh commented Mar 9, 2020

Cookie version 0 does not allow cookies but v1 allow cookies.
According to RFC 2109, "HTTP State Management Mechanism", white space in cookie values must be encoded or the entire value must be quoted .(source)
As we cannot ask instagram to use cookie version 0, youtube-dl should be updated.

@EhsanCh
Copy link
Author

@EhsanCh EhsanCh commented Mar 9, 2020

As a quick fix, youtube-dl can at least ignore such cookies and don't stop for such errors...
then cookie component should be fixed, if it require more time.

@dstftw Please reopen this issue and remove invalid label.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 9, 2020

RFC2109 is obsolete. Current RFC 6265 clearly disallows spaces inside cookie values.

@ytdl-org ytdl-org locked and limited conversation to collaborators Mar 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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