Downloads run for minutes via Popen while metadata calls continue in parallel. Both processes read from AND write back to the same --cookies file, causing concurrent writes that corrupt the session cookie state. Fix: _make_private_cookie_copy() intercepts --cookies <file> in any arg list and swaps it for a NamedTemporaryFile copy. Each yt-dlp process gets its own snapshot; write-backs go to the throwaway copy and are discarded on cleanup. - _run() uses this for all subprocess.run calls (metadata, subtitles, comments) - start_download() uses it for the long-lived Popen download process - _meta_run() benefits automatically since it calls _run() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 KiB
34 KiB