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

youtube-dl overwrites cookies.txt #16505

Closed
Troyciv opened this issue May 20, 2018 · 2 comments
Closed

youtube-dl overwrites cookies.txt #16505

Troyciv opened this issue May 20, 2018 · 2 comments

Comments

@Troyciv
Copy link

@Troyciv Troyciv commented May 20, 2018

  • I've verified and I assure that I'm running youtube-dl 2018.05.18

  • At least skimmed through the README, most notably the FAQ and BUGS sections

  • Searched the bugtracker for similar issues including closed ones

  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)

What's the issue?

I saved my browser cookies in a cookies.txt file. I verified (twice!) that the file contains my cookies.

After that I ran youtube-dl --verbose --cookies ~/Downloads/cookies.txt https://globoplay.globo.com/v/6733094/programa/

Ater that I checked the cookies.txt and noticed that all the cookies got deleted from the file. Now it looks like this:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

I don't think youtube-dl should overwrite the cookies.txt


[debug] System config: []                                                                                                                      
[debug] User config: []                                                                                                                        
[debug] Custom config: []                                                                                                                      
[debug] Command-line args: [u'--verbose', u'--cookies', u'/home/user/Downloads/cookies.txt', u'https://globoplay.globo.com/v/6733094/programa/']                                                                                                                                              
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8                                                                               
[debug] youtube-dl version 2018.05.18                                                                                                          
[debug] Python version 2.7.14 (CPython) - Linux-4.13.0-41-generic-x86_64-with-Ubuntu-17.10-artful                                              
[debug] exe versions: ffmpeg 3.3.4-2, ffprobe 3.3.4-2, rtmpdump 2.4    
[debug] Proxy map: {}        

@Troyciv
Copy link
Author

@Troyciv Troyciv commented May 20, 2018

I also tried to remove write permissions with chmod 444 cookies.txt

When running youtube-dl --verbose --cookies ~/Downloads/cookies.txt https://globoplay.globo.com/v/6733094/programa/ again, I get the following error:

[Globo] 6733094: Downloading JSON metadata                                                                                                     
[Globo] 6733094: Downloading security hash for 6733094_90_720_collection                                                                       
ERROR: Globo returned error: Video is for subscribers only. Authorization required.                                                            
Traceback (most recent call last):                                                                                                             
  File "/home/user/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 792, in extract_info                                                          
    ie_result = ie.extract(url)                                                                                                                
  File "/home/user/bin/youtube-dl/youtube_dl/extractor/common.py", line 503, in extract                                                        
    ie_result = self._real_extract(url)                                
  File "/home/user/bin/youtube-dl/youtube_dl/extractor/globo.py", line 360, in _real_extract                                                   
    '%s returned error: %s' % (self.IE_NAME, message), expected=True)  
ExtractorError: Globo returned error: Video is for subscribers only. Authorization required.

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 "/home/user/bin/youtube-dl/__main__.py", line 19, in <module>   
  File "/home/user/bin/youtube-dl/youtube_dl/__init__.py", line 472, in main
  File "/home/user/bin/youtube-dl/youtube_dl/__init__.py", line 465, in _real_main
  File "/home/user/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 561, in __exit__
  File "/usr/lib/python2.7/_MozillaCookieJar.py", line 118, in save    
    f = open(filename, "w")        
IOError: [Errno 13] Permission denied: u'/home/user/Downloads/cookies.txt'

I don't know why youtube-dl wants write permission to the cookies file.

I am aware that the website (Globo) also gave me an error, but this shouldn't cause the cookies.txt overwrite.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 20, 2018

This is expected behavior since server may send Set-Cookie headers that should be respected.

@dstftw dstftw closed this May 20, 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
2 participants
You can’t perform that action at this time.