mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
Merge 5ff34751a3
into 05c8023a27
This commit is contained in:
commit
29b20fd7d3
1 changed files with 4 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue