Repository navigation
cookies_file: private temp copy when unwritable or shared by workers - #49
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33.
yt-dlp rewrites its
cookiefileon exit. Now_final_optsmerges the options (base, cookies,extra_opts) and, when the cookie file (fromcookies_file, the default, orextra_opts["cookiefile"]) is not writable, orYB_COOKIES_PRIVATE_COPYis truthy, hands yt-dlp a 0600 temporary copy that is deleted afterwards (also on failure). Refreshed cookies are then not persisted. One helper replaces the cookie wiring at the three call sites (_extract_info, video download, playlist download), so search, info, audio anddownload_audio_boundedall get it.Design call: the "caller asks" case is an env var rather than a keyword on seven public functions; parallel workers are a deployment property. File lock for the persisting case is not added (documented: every worker must set the env var).
Adversarial review (Opus): mechanism sound; one real problem: a
cookiefileinextra_opts(the server-deployment path, and whatdownload_audio_boundedallows) bypassed the copy. Fixed by copying from the merged options; the same fix dedups the wiring (three copies to one helper). Added tests: extra_opts cookiefile for all five entry points, copy mode 0600 and deleted on failure, really-chmod-0444 file (non-root POSIX). Checked fine by the reviewer: ydl use after exit, merge order, browser cookies, KeyboardInterrupt cleanup, Windows os.access.