Skip to content

Commit

Permalink
Added option to download through a proxy (#308)
Browse files Browse the repository at this point in the history
* added proxy support

* Update youtube.py

* Update youtube.py

* Indentation

* Update spotify_dl.py

* Update spotify_dl/youtube.py

Co-authored-by: Sathyajith Bhat <[email protected]>

Co-authored-by: Kali <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>
Co-authored-by: Sathyajith Bhat <[email protected]>
  • Loading branch information
Diiak and SathyaBhat authored Oct 30, 2022
1 parent f255827 commit 5431943
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spotify_dl/spotify_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ def spotify_dl():
default=0,
help="Use multiprocessing [-m [int:numcores]",
)
parser.add_argument(
"-p",
"--proxy",
action="store",
type=str,
default="",
help="Download through a proxy. Support HTTP & SOCKS5. Use 'http://username:password@hostname:port' or 'http://hostname:port'",
)
args = parser.parse_args()
num_cores = os.cpu_count()
args.multi_core = int(args.multi_core)
Expand Down Expand Up @@ -185,6 +193,7 @@ def spotify_dl():
use_sponsorblock=args.use_sponsorblock,
file_name_f=file_name_f,
multi_core=args.multi_core,
proxy=args.proxy,
)


Expand Down
1 change: 1 addition & 0 deletions spotify_dl/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def find_and_download_songs(kwargs):
file_path = path.join(kwargs["track_db"][i]["save_path"], file_name)
outtmpl = f"{file_path}.%(ext)s"
ydl_opts = {
"proxy": kwargs.get('proxy'),
"default_search": "ytsearch",
"format": "bestaudio/best",
"outtmpl": outtmpl,
Expand Down

0 comments on commit 5431943

Please sign in to comment.