Skip to content

Commit

Permalink
Add support for passing credentials to yt-dlp
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjyoti30 committed Aug 15, 2024
1 parent 40792bc commit d8f288c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ytmdl/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Store the version of the package
__version__ = "2024.08.15"
__version__ = "2024.08.15.1"
12 changes: 9 additions & 3 deletions ytmdl/yt.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def dw_using_yt(
no_progress=False,
ytdl_config: str = None,
dont_convert: bool = False,
cookiefile=None
cookiefile=None,
creds = None
):
"""
Download the song using YTDL downloader and use downloader CLI's
Expand Down Expand Up @@ -132,6 +133,10 @@ def dw_using_yt(

if cookiefile is not None:
ydl_opts['cookiefile'] = cookiefile

if creds is not None:
ydl_opts["username"] = creds.get("username", "")
ydl_opts["password"] = creds.get("password", "")

logger.debug("args passed: ", str(ydl_opts))
ydl = yt_dlp.YoutubeDL(ydl_opts)
Expand All @@ -152,7 +157,8 @@ def dw(
no_progress=False,
ytdl_config: str = None,
dont_convert: bool = False,
cookiefile: str = None
cookiefile: str = None,
creds = None
):
"""
Download the song.
Expand Down Expand Up @@ -187,7 +193,7 @@ def dw(
# Start downloading the song
status = dw_using_yt(value, proxy, name, datatype,
no_progress, ytdl_config, dont_convert,
cookiefile)
cookiefile, creds)

if status == 0:
return name
Expand Down

0 comments on commit d8f288c

Please sign in to comment.