mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-12-17 14:45:42 +07:00
[utils] Add support for cookies with spaces used instead of tabs
This commit is contained in:
@@ -2752,6 +2752,11 @@ def load(self, filename=None, ignore_discard=False, ignore_expires=False):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user