diff options
author | Remita Amine <remitamine@gmail.com> | 2021-04-03 07:54:02 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2021-04-03 07:54:16 +0100 |
commit | 1df2596f81695bf452ffbfd89596d115d9b2daf5 (patch) | |
tree | 492b9d367ca3e783482c3d3bc021f7c9b92a949b /youtube_dl/extractor/common.py | |
parent | 04d4a3b136060158438c3f2c1b31c884c6961712 (diff) | |
download | youtube-dl-1df2596f81695bf452ffbfd89596d115d9b2daf5.tar.xz |
[extractor/common] fix _get_cookies method for python 2(#20673, #23256, #20326, closes #28640)
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r-- | youtube_dl/extractor/common.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index d3b6724df..fcbf18ee6 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -2899,7 +2899,10 @@ class InfoExtractor(object): """ Return a compat_cookies.SimpleCookie with the cookies for the url """ req = sanitized_Request(url) self._downloader.cookiejar.add_cookie_header(req) - return compat_cookies.SimpleCookie(req.get_header('Cookie')) + cookie = req.get_header('Cookie') + if cookie and sys.version_info[0] == 2: + cookie = str(cookie) + return compat_cookies.SimpleCookie(cookie) def _apply_first_set_cookie_header(self, url_handle, cookie): """ |