Add cookies to yt-dlp config and docker env#7510
Open
vinybrun wants to merge 3 commits intoChocobozzz:developfrom
Open
Add cookies to yt-dlp config and docker env#7510vinybrun wants to merge 3 commits intoChocobozzz:developfrom
vinybrun wants to merge 3 commits intoChocobozzz:developfrom
Conversation
Chocobozzz
requested changes
Mar 26, 2026
Owner
Chocobozzz
left a comment
There was a problem hiding this comment.
Thank you! From our experience using many ISP/residential for import.videos.http.proxies option helps a lot, but this method can also help to bypass blocked videos.
Author
|
Awesome! Thanks for the feedback, I'll implement the changes soon. |
a66c26d to
2cfd8fd
Compare
Author
|
Hi @Chocobozzz I implemented the changes you pointed in your review, and they really improved the code quality. It looks much cleaner now. I tested again in a local install and docker and all looks good. Also created a Merge Request for the docs on Framagit: https://framagit.org/framasoft/peertube/documentation/-/merge_requests/165 If I missed anything or if you have any other suggestions, just let me know and I'll be happy to adjust it. |
2cfd8fd to
0495c1e
Compare
d7b84f6 to
242a2a4
Compare
242a2a4 to
857a939
Compare
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.
Description
Hello,
This PR addresses YouTube imports failing due to bot detection.
Specifically:
For context, I work for a company that hosts PeerTube (and other software) for content creators, and we sync their content from YouTube to PeerTube for redundancy.
I found several related issues here (#5688, #6864, #6522, #6494) and on yt-dlp’s repository (yt-dlp/yt-dlp#16212, yt-dlp/yt-dlp#10128, yt-dlp/yt-dlp#16147).
After reviewing them, I tested a few approaches:
I tried the approach suggested on this comment: #6522 (comment)
The wrapper worked, but since PeerTube overwrites the yt-dlp binary, it was only a temporary fix.
Then I created a patch in one of my instances to add the --cookies argument to the compiled PeerTube JS files, and it worked.
Since that approach was also temporary, and this may help others, I turned it into this PR.
Disclaimer: this PR was created with AI (ChatGPT Codex). I reviewed all files manually and made adjustments for maintainability and consistency. I also ran unit tests and tested imports with cookies in both a local dev environment and Docker; all succeeded.
Functionality: when cookies are enabled in the config, imports use yt-dlp with the --cookies argument pointing to the configured file.
I chose to create the cookies file at server startup, but I’m not sure if that’s the best approach.
I initially exposed the cookies file path, but ended up using a fixed path and creating the file automatically, so users only need to populate it.
I'm unsure about the paths and config names I chose (especially
importin the storage folder). Those can be altered for better clarity if needed. Suggestions are welcome.Known limitations:
This topic has been discussed for a while, so I expect others may have input. Happy to adjust anything if needed. Thanks.
Related issues
#5688, #6864, #6522, #6494
Has this been tested?