1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00
This commit is contained in:
PuppyPi 2025-03-09 04:23:03 +05:30 committed by GitHub
commit 29b20fd7d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1327,18 +1327,20 @@ def load(self, filename=None, ignore_discard=True, ignore_expires=True):
raise ValueError(http.cookiejar.MISSING_FILENAME_TEXT)
def prepare_line(line):
assert line.endswith('\n')
line = line[:-1]
if line.startswith(self._HTTPONLY_PREFIX):
line = line[len(self._HTTPONLY_PREFIX):]
# comments and empty lines are fine
if line.startswith('#') or not line.strip():
return line
return line + '\n'
cookie_list = line.split('\t')
if len(cookie_list) != self._ENTRY_LEN:
raise http.cookiejar.LoadError(f'invalid length {len(cookie_list)}')
cookie = self._CookieFileEntry(*cookie_list)
if cookie.expires_at and not cookie.expires_at.isdigit():
raise http.cookiejar.LoadError(f'invalid expires at {cookie.expires_at}')
return line
return line + '\n'
cf = io.StringIO()
with self.open(filename) as f: