yt-dlp-utils 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of yt-dlp-utils might be problematic. Click here for more details.
- yt_dlp_utils/__init__.py +1 -1
- yt_dlp_utils/lib.py +23 -13
- {yt_dlp_utils-0.0.1.dist-info → yt_dlp_utils-0.0.3.dist-info}/METADATA +10 -9
- yt_dlp_utils-0.0.3.dist-info/RECORD +8 -0
- yt_dlp_utils-0.0.1.dist-info/RECORD +0 -8
- {yt_dlp_utils-0.0.1.dist-info → yt_dlp_utils-0.0.3.dist-info}/LICENSE.txt +0 -0
- {yt_dlp_utils-0.0.1.dist-info → yt_dlp_utils-0.0.3.dist-info}/WHEEL +0 -0
yt_dlp_utils/__init__.py
CHANGED
yt_dlp_utils/lib.py
CHANGED
|
@@ -22,7 +22,7 @@ __all__ = ('YoutubeDLLogger', 'get_configured_yt_dlp', 'setup_session')
|
|
|
22
22
|
log = logging.getLogger(__name__)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class YoutubeDLLogger:
|
|
25
|
+
class YoutubeDLLogger(yt_dlp.cookies.YDLLogger):
|
|
26
26
|
"""Logger for yt-dlp."""
|
|
27
27
|
def debug(self, message: str) -> None:
|
|
28
28
|
"""Log a debug message."""
|
|
@@ -34,7 +34,11 @@ class YoutubeDLLogger:
|
|
|
34
34
|
"""Log an info message."""
|
|
35
35
|
log.info('%s', re.sub(r'^\[info\]\s+', '', message))
|
|
36
36
|
|
|
37
|
-
def warning(
|
|
37
|
+
def warning(
|
|
38
|
+
self,
|
|
39
|
+
message: str,
|
|
40
|
+
once: bool = False, # noqa: FBT001, FBT002
|
|
41
|
+
only_once: bool = False) -> None: # noqa: FBT001, FBT002
|
|
38
42
|
"""Log a warning message."""
|
|
39
43
|
log.warning('%s', re.sub(r'^\[warn(?:ing)?\]\s+', '', message))
|
|
40
44
|
|
|
@@ -82,12 +86,12 @@ def get_configured_yt_dlp(sleep_time: int = 3,
|
|
|
82
86
|
|
|
83
87
|
def setup_session(browser: str,
|
|
84
88
|
profile: str,
|
|
85
|
-
domains: Iterable[str],
|
|
86
|
-
headers: Mapping[str, str] | None = None,
|
|
87
89
|
add_headers: Mapping[str, str] | None = None,
|
|
88
90
|
backoff_factor: float = DEFAULT_RETRY_BACKOFF_FACTOR,
|
|
89
|
-
|
|
91
|
+
domains: Iterable[str] | None = None,
|
|
92
|
+
headers: Mapping[str, str] | None = None,
|
|
90
93
|
session: requests.Session | None = None,
|
|
94
|
+
status_forcelist: Collection[int] = DEFAULT_RETRY_STATUS_FORCELIST,
|
|
91
95
|
*,
|
|
92
96
|
setup_retry: bool = False) -> requests.Session:
|
|
93
97
|
"""
|
|
@@ -99,14 +103,14 @@ def setup_session(browser: str,
|
|
|
99
103
|
The browser to extract cookies from.
|
|
100
104
|
profile : str
|
|
101
105
|
The profile to extract cookies from.
|
|
102
|
-
domains : Iterable[str]
|
|
103
|
-
The domains of which to extract cookies.
|
|
104
|
-
headers : Mapping[str, str]
|
|
105
|
-
The headers to use for the requests session. If not specified, a default set will be used.
|
|
106
106
|
add_headers : Mapping[str, str]
|
|
107
107
|
Additional headers to add to the requests session.
|
|
108
108
|
backoff_factor : float
|
|
109
109
|
The backoff factor to use for the retry mechanism.
|
|
110
|
+
domains : Iterable[str]
|
|
111
|
+
Filter the cookies to only those that match the specified domains.
|
|
112
|
+
headers : Mapping[str, str]
|
|
113
|
+
The headers to use for the requests session. If not specified, a default set will be used.
|
|
110
114
|
status_forcelist : Collection[int]
|
|
111
115
|
The status codes to retry on.
|
|
112
116
|
setup_retry : bool
|
|
@@ -120,14 +124,20 @@ def setup_session(browser: str,
|
|
|
120
124
|
headers = headers or SHARED_HEADERS
|
|
121
125
|
add_headers = add_headers or {}
|
|
122
126
|
session = session or requests.Session()
|
|
127
|
+
session.headers.update(headers)
|
|
128
|
+
session.headers.update(add_headers)
|
|
123
129
|
if setup_retry:
|
|
124
130
|
session.mount(
|
|
125
131
|
'https://',
|
|
126
132
|
HTTPAdapter(max_retries=Retry(backoff_factor=backoff_factor,
|
|
127
133
|
status_forcelist=status_forcelist)))
|
|
128
134
|
extracted = extract_cookies_from_browser(browser, profile)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
if not domains:
|
|
136
|
+
session.cookies.update(extracted)
|
|
137
|
+
else:
|
|
138
|
+
for domain in (d.lstrip('.') for d in domains):
|
|
139
|
+
for cookie in extracted.get_cookies_for_url(f'https://{domain}'):
|
|
140
|
+
if not isinstance(cookie.value, str):
|
|
141
|
+
continue
|
|
142
|
+
session.cookies.set(cookie.name, cookie.value, domain=domain)
|
|
133
143
|
return session
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: yt-dlp-utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Utilities for programmatic use of yt-dlp.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: command line,yt-dlp
|
|
@@ -27,24 +27,25 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
|
|
28
28
|
# yt-dlp-utils
|
|
29
29
|
|
|
30
|
+
[](https://www.python.org/)
|
|
31
|
+
[](https://pypi.org/project/yt-dlp-utils/)
|
|
32
|
+
[](https://github.com/Tatsh/yt-dlp-utils/tags)
|
|
33
|
+
[](https://github.com/Tatsh/yt-dlp-utils/blob/master/LICENSE.txt)
|
|
34
|
+
[](https://github.com/Tatsh/yt-dlp-utils/compare/v0.0.3...master)
|
|
30
35
|
[](https://github.com/Tatsh/yt-dlp-utils/actions/workflows/qa.yml)
|
|
31
36
|
[](https://github.com/Tatsh/yt-dlp-utils/actions/workflows/tests.yml)
|
|
32
37
|
[](https://coveralls.io/github/Tatsh/yt-dlp-utils?branch=master)
|
|
33
38
|
[](https://yt-dlp-utils.readthedocs.org/?badge=latest)
|
|
34
|
-
[](https://pypi.org/project/yt-dlp-utils/)
|
|
35
|
-
[](https://github.com/Tatsh/yt-dlp-utils/tags)
|
|
36
|
-
[](https://github.com/Tatsh/yt-dlp-utils/blob/master/LICENSE.txt)
|
|
37
|
-
[](https://github.com/Tatsh/yt-dlp-utils/compare/v0.0.1...master)
|
|
38
|
-

|
|
39
39
|
[](http://mypy-lang.org/)
|
|
40
40
|
[](https://github.com/pre-commit/pre-commit)
|
|
41
41
|
[](http://www.pydocstyle.org/en/stable/)
|
|
42
42
|
[](https://docs.pytest.org/en/stable/)
|
|
43
|
-
[](https://www.python.org)
|
|
44
43
|
[](https://github.com/astral-sh/ruff)
|
|
44
|
+
[](https://pepy.tech/project/yt-dlp-utils)
|
|
45
|
+
[](https://github.com/Tatsh/yt-dlp-utils/stargazers)
|
|
45
46
|
|
|
46
|
-
[](https://bsky.app/profile/
|
|
47
|
-
[](https://hostux.social/@
|
|
47
|
+
[](https://bsky.app/profile/Tatsh.bsky.social)
|
|
48
|
+
[](https://hostux.social/@Tatsh)
|
|
48
49
|
|
|
49
50
|
Utilities for programmatic use of yt-dlp.
|
|
50
51
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
yt_dlp_utils/__init__.py,sha256=X7TiX3gMNiWQ0TxPn955yYVwHUCAJAIddmQR2axyJOk,250
|
|
2
|
+
yt_dlp_utils/constants.py,sha256=CXWDlIFPB_Aom_dfa9RwACX8i8DANivmlT0GQxnrYDg,729
|
|
3
|
+
yt_dlp_utils/lib.py,sha256=hlzLfdouTdDT_b-7O4bg6zPKKee5Kn7rCFTuXxBxzAs,5127
|
|
4
|
+
yt_dlp_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
yt_dlp_utils-0.0.3.dist-info/LICENSE.txt,sha256=1z3v176A2bAtCVZXlb8HZXUf3HpQIjW2GanQd8PaVK4,1087
|
|
6
|
+
yt_dlp_utils-0.0.3.dist-info/METADATA,sha256=geul-XdSNkzzRa8OaFK4cy3kkSIpDasiXMIVVsGZ8Zk,4023
|
|
7
|
+
yt_dlp_utils-0.0.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
8
|
+
yt_dlp_utils-0.0.3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
yt_dlp_utils/__init__.py,sha256=0aI_jpTZ6mJ_xJ1tUTQI2boXO14JfvDwlGRaUYA5R74,250
|
|
2
|
-
yt_dlp_utils/constants.py,sha256=CXWDlIFPB_Aom_dfa9RwACX8i8DANivmlT0GQxnrYDg,729
|
|
3
|
-
yt_dlp_utils/lib.py,sha256=4ExLDxdE1V0CBjD5YAYy17xBTKrZNPS_ZRHrUWBI7jU,4759
|
|
4
|
-
yt_dlp_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
yt_dlp_utils-0.0.1.dist-info/LICENSE.txt,sha256=1z3v176A2bAtCVZXlb8HZXUf3HpQIjW2GanQd8PaVK4,1087
|
|
6
|
-
yt_dlp_utils-0.0.1.dist-info/METADATA,sha256=NrPGuFtXFQgo3C0fkV23VDbtcr3Nz9xpG5bjMYjptwE,3823
|
|
7
|
-
yt_dlp_utils-0.0.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
8
|
-
yt_dlp_utils-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|