]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[YoutubeDL] Recognize expires=0 as session cookies and send session cookies with...
authoraegamesi <admin.aegamesi@gmail.com>
Sun, 30 Apr 2017 05:56:33 +0000 (22:56 -0700)
committerSergey M․ <dstftw@gmail.com>
Sat, 8 Dec 2018 23:05:37 +0000 (06:05 +0700)
youtube_dl/YoutubeDL.py

index 38ba43a977c1627f4d1f7a181c093477108ab959..2433f74f41478221e9527cab6f44bed8ca1c9942 100755 (executable)
@@ -2300,7 +2300,13 @@ class YoutubeDL(object):
             self.cookiejar = compat_cookiejar.MozillaCookieJar(
                 opts_cookiefile)
             if os.access(opts_cookiefile, os.R_OK):
-                self.cookiejar.load()
+                self.cookiejar.load(ignore_discard=True, ignore_expires=True)
+                # Force CookieJar to treat 'expires=0' cookies as session/discard cookies
+                # Fixes https://bugs.python.org/issue17164
+                for cookie in self.cookiejar:
+                    if cookie.expires == 0:
+                        cookie.expires = None
+                        cookie.discard = True
 
         cookie_processor = YoutubeDLCookieProcessor(self.cookiejar)
         if opts_proxy is not None: