aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/external.py
diff options
context:
space:
mode:
authorbashonly <bashonly@bashonly.com>2023-07-15 15:18:25 -0500
committerbashonly <bashonly@bashonly.com>2023-07-15 15:25:51 -0500
commit42ded0a429c20ec13dc006825e1508d9a02f0ad4 (patch)
treef52cab726165d92b3ef0c108206a0dba99742b9c /yt_dlp/downloader/external.py
parent6c5211cebeacfc53ad5d5ddf4a659be76039656f (diff)
downloadhypervideo-pre-42ded0a429c20ec13dc006825e1508d9a02f0ad4.tar.lz
hypervideo-pre-42ded0a429c20ec13dc006825e1508d9a02f0ad4.tar.xz
hypervideo-pre-42ded0a429c20ec13dc006825e1508d9a02f0ad4.zip
[fd/external] Fixes to cookie handling
- Fix bug in `axel` Cookie header arg - Pass cookies to `curl` as strings - Write session cookies for `aria2c` and `wget` Closes #7539 Authored by: bashonly
Diffstat (limited to 'yt_dlp/downloader/external.py')
-rw-r--r--yt_dlp/downloader/external.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index e307502db..4f52f6e8d 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -137,7 +137,7 @@ class ExternalFD(FragmentFD):
self._cookies_tempfile = tmp_cookies.name
self.to_screen(f'[download] Writing temporary cookies file to "{self._cookies_tempfile}"')
# real_download resets _cookies_tempfile; if it's None then save() will write to cookiejar.filename
- self.ydl.cookiejar.save(self._cookies_tempfile)
+ self.ydl.cookiejar.save(self._cookies_tempfile, ignore_discard=True, ignore_expires=True)
return self.ydl.cookiejar.filename or self._cookies_tempfile
def _call_downloader(self, tmpfilename, info_dict):
@@ -199,8 +199,9 @@ class CurlFD(ExternalFD):
def _make_cmd(self, tmpfilename, info_dict):
cmd = [self.exe, '--location', '-o', tmpfilename, '--compressed']
- if self.ydl.cookiejar.get_cookie_header(info_dict['url']):
- cmd += ['--cookie-jar', self._write_cookies()]
+ cookie_header = self.ydl.cookiejar.get_cookie_header(info_dict['url'])
+ if cookie_header:
+ cmd += ['--cookie', cookie_header]
if info_dict.get('http_headers') is not None:
for key, val in info_dict['http_headers'].items():
cmd += ['--header', f'{key}: {val}']
@@ -233,7 +234,7 @@ class AxelFD(ExternalFD):
cmd += ['-H', f'{key}: {val}']
cookie_header = self.ydl.cookiejar.get_cookie_header(info_dict['url'])
if cookie_header:
- cmd += [f'Cookie: {cookie_header}', '--max-redirect=0']
+ cmd += ['-H', f'Cookie: {cookie_header}', '--max-redirect=0']
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd