Repository navigation
Stop concurrent downloads corrupting the shared cookies.txt - #577
henriquesebastiao merged 1 commit into
Conversation
yt-dlp rewrites cookiefile when it closes, so several downloads from one
playlist kept truncating the single cookies.txt at once and a concurrent
reader hit a half-written file ("does not look like a Netscape format
cookies file"). Give each download a private copy of the jar so the
save-back never touches the shared path.
Fixes henriquesebastiao#570. Tested with a yt-dlp fake that rewrites cookiefile on exit;
the shared file is now left byte-for-byte unchanged.
👋 Welcome to Downtify, and thanks for your first pull request!It's great to have you here. Every contribution (code, tests, docs or translations) helps keep Downtify alive, and we're glad you chose to spend your time on it. A maintainer will review this PR as soon as possible. In the meantime, here's what helps it get merged ✅ Before review
🧭 Project rules worth knowing
📝 A good PR description
💬 Need help?
Reviews are a conversation, so expect a round or two of feedback. That's normal, not a sign something is wrong. By contributing, you agree that your work is licensed under the project's AGPL-3.0 Thanks again, and welcome aboard! 🎶 |
|
The failing |
d755cd5
into
henriquesebastiao:main
yt-dlp rewrites
cookiefilewhen theYoutubeDLcontext closes (it truncates the file and writes the jar back). When a playlist runs several downloads in parallel they all point at the same/data/cookies.txt, so one instance truncates it while another is reading it — which is the intermittent "does not look like a Netscape format cookies file" from #570. Retrying works because by then the write has finished.This gives each download a private copy of the cookie jar, so yt-dlp's save-back lands on a throwaway temp file and the shared one is never the file being rewritten.
Fixes #570.
Tested with a yt-dlp fake that rewrites
cookiefileon exit: without the change the shared cookies.txt is clobbered, with it the file stays byte-for-byte unchanged. Full downloader + cookies suites pass (pytest tests/test_downloader_extended.py tests/test_cookies_store.py tests/test_downloader.py, 144 passed), ruff clean.