diff options
author | Sergey M․ <dstftw@gmail.com> | 2020-03-08 17:52:19 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2020-03-08 18:01:32 +0700 |
commit | cff99c91d150df2a4e21962a3ca8d4ae94533b8c (patch) | |
tree | d7255407b40c57a8c3aab39b7b5bfce7ea06f54f /youtube_dl/utils.py | |
parent | fa9b8c662808a50605bb05f90af101e13b30fce6 (diff) |
[utils] Add support for cookies with spaces used instead of tabs
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 8ccf25489..93d1dec05 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2752,6 +2752,11 @@ class YoutubeDLCookieJar(compat_cookiejar.MozillaCookieJar): for line in f: if line.startswith(self._HTTPONLY_PREFIX): line = line[len(self._HTTPONLY_PREFIX):] + # Cookie file may contain spaces instead of tabs. + # Replace all spaces with tabs to make such cookie files work + # with MozillaCookieJar. + if not line.startswith('#'): + line = re.sub(r' +', r'\t', line) cf.write(compat_str(line)) cf.seek(0) self._really_load(cf, filename, ignore_discard, ignore_expires) |