Skip to content

Commit d8f288c

Browse files
committed
Add support for passing credentials to yt-dlp
1 parent 40792bc commit d8f288c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ytmdl/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Store the version of the package
2-
__version__ = "2024.08.15"
2+
__version__ = "2024.08.15.1"

ytmdl/yt.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def dw_using_yt(
8484
no_progress=False,
8585
ytdl_config: str = None,
8686
dont_convert: bool = False,
87-
cookiefile=None
87+
cookiefile=None,
88+
creds = None
8889
):
8990
"""
9091
Download the song using YTDL downloader and use downloader CLI's
@@ -132,6 +133,10 @@ def dw_using_yt(
132133

133134
if cookiefile is not None:
134135
ydl_opts['cookiefile'] = cookiefile
136+
137+
if creds is not None:
138+
ydl_opts["username"] = creds.get("username", "")
139+
ydl_opts["password"] = creds.get("password", "")
135140

136141
logger.debug("args passed: ", str(ydl_opts))
137142
ydl = yt_dlp.YoutubeDL(ydl_opts)
@@ -152,7 +157,8 @@ def dw(
152157
no_progress=False,
153158
ytdl_config: str = None,
154159
dont_convert: bool = False,
155-
cookiefile: str = None
160+
cookiefile: str = None,
161+
creds = None
156162
):
157163
"""
158164
Download the song.
@@ -187,7 +193,7 @@ def dw(
187193
# Start downloading the song
188194
status = dw_using_yt(value, proxy, name, datatype,
189195
no_progress, ytdl_config, dont_convert,
190-
cookiefile)
196+
cookiefile, creds)
191197

192198
if status == 0:
193199
return name

0 commit comments

Comments
 (0)