New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cookies] Move YouTubeDLCookieJar
to cookies.py
#7091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these are cosmetic, feel free to ignore
I wasn't really planning on changing the cookiejar code itself in this PR to keep it simple - maybe worth refactoring it in another PR/commit? |
Sure, like I said, feel free to ignore these. I can take them into another PR at some point. |
Don't think this needed to be it's own PR. But since you made it, we might as well merge. After merging the relevant open PRs', can you rebase/merge #2861 and we can discuss a more reasonable way to split it up? (PS: To clarify, I don't mind the small PRs, just think I'm adding more work for you) |
ee280c7
to
7aeda6c
Compare
Authored by: coletdjnz
IMPORTANT: PRs without the template will be CLOSED
Description of your pull request and other information
ADD DESCRIPTION HERE
Backport from #2861
Also added a
get_cookie_header
function to the cookiejar (also from backport)Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?
Copilot Summary
馃 Generated by Copilot at dc7be9b
Summary
馃崻馃殮馃Ч
This pull request refactors the cookie management in yt-dlp by moving the
YoutubeDLCookieJar
class to a separate moduleyt_dlp/cookies.py
and using it directly in theYoutubeDL
andInfoExtractor
classes. It also adds tests and updates imports for the new module. It maintains backward compatibility for external modules that importYoutubeDLCookieJar
fromutils
.Walkthrough
YoutubeDLCookieJar
class fromyt_dlp/utils/_utils.py
toyt_dlp/cookies.py
as a separate module for handling cookie files and headers (link, link)yt_dlp/cookies.py
,yt_dlp/extractor/common.py
,yt_dlp/utils/_legacy.py
, andtest/test_YoutubeDLCookieJar.py
to reflect the new location ofYoutubeDLCookieJar
class (link, link, link, link, link)YoutubeDLCookieJar
inyt_dlp/utils/_legacy.py
to maintain backward compatibility for external modules that import it from utils (link)_get_cookies
method inInfoExtractor
class and_calc_headers
method inYoutubeDL
class to use thecookiejar
attribute instead of the_calc_cookies
method to get the cookies for a url and generate the Cookie header (link, link)_calc_cookies
method fromYoutubeDL
class as it is no longer needed (link)TestYoutubeDLCookieJar
to check the functionality of theget_cookie_header
method (link)urllib.request
module inyt_dlp/cookies.py
to use theRequest
class for generating the cookie header (link)