aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authoraegamesi <admin.aegamesi@gmail.com>2017-04-29 22:56:33 -0700
committerSergey M․ <dstftw@gmail.com>2018-12-09 06:05:37 +0700
commit1d88b3e6e6e59e4b52305faf6c1bf1fd69c555ee (patch)
tree2215b80946b5b579e904405025d5f59304a46963 /youtube_dl/YoutubeDL.py
parent9235b5091cedcc21c8dc32d4b292340edeee4ed0 (diff)
[YoutubeDL] Recognize expires=0 as session cookies and send session cookies with requests
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 38ba43a97..2433f74f4 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -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: