Compare commits

..

2 Commits

Author SHA1 Message Date
Elyse
00828e2c93
[downloader/ffmpeg] Specify headers for each URL (#3553)
Closes #2696
Authored by: elyse0
2022-04-26 02:54:56 -07:00
pukkandan
7ab56be2c7
[build] Ensure compat._legacy is packed in executables
Fixes 9196cbfe8b (commitcomment-72192406)
2022-04-26 15:13:17 +05:30
3 changed files with 16 additions and 6 deletions

View File

@ -47,6 +47,7 @@ def main():
'--noconfirm',
*dependency_options(),
*opts,
'--collect-submodules=yt_dlp',
'yt_dlp/__main__.py',
]
print(f'Running PyInstaller with {opts}')

View File

@ -48,6 +48,8 @@ if sys.argv[1:2] == ['py2exe']:
'dist_dir': './dist',
'excludes': ['Crypto', 'Cryptodome'], # py2exe cannot import Crypto
'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
# Modules that are only imported dynamically must be added here
'includes': ['yt_dlp.compat._legacy'],
}
},
'zipfile': None

View File

@ -382,13 +382,15 @@ class FFmpegFD(ExternalFD):
# if end_time:
# args += ['-t', compat_str(end_time - start_time)]
if info_dict.get('http_headers') is not None and re.match(r'^https?://', urls[0]):
http_headers = None
if info_dict.get('http_headers'):
youtubedl_headers = handle_youtubedl_headers(info_dict['http_headers'])
http_headers = [
# Trailing \r\n after each HTTP header is important to prevent warning from ffmpeg/avconv:
# [http @ 00000000003d2fa0] No trailing CRLF found in HTTP header.
headers = handle_youtubedl_headers(info_dict['http_headers'])
args += [
'-headers',
''.join(f'{key}: {val}\r\n' for key, val in headers.items())]
''.join(f'{key}: {val}\r\n' for key, val in youtubedl_headers.items())
]
env = None
proxy = self.params.get('proxy')
@ -441,6 +443,11 @@ class FFmpegFD(ExternalFD):
args += ['-rtmp_conn', conn]
for i, url in enumerate(urls):
# We need to specify headers for each http input stream
# otherwise, it will only be applied to the first.
# https://github.com/yt-dlp/yt-dlp/issues/2696
if http_headers is not None and re.match(r'^https?://', url):
args += http_headers
args += self._configuration_args((f'_i{i + 1}', '_i')) + ['-i', url]
args += ['-c', 'copy']