spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17k stars 1.56k forks source link

Add Proxy Support to Bypass Regional Restrictions on Spotify #2185

Closed git-GeekNerd closed 5 days ago

git-GeekNerd commented 1 week ago

Requested Feature

Hi! I’d like to suggest adding an option to use proxy servers within SpotDL.

Problem

I am located in a country that faces regional restrictions on Spotify, and because of this, I receive the following error when trying to access Spotify:

HTTP Status: 403, Code: -1
Spotify is unavailable in this country, reason: None

To bypass this restriction, I have to use a proxy server. However, SpotDL currently doesn't offer an option to set up a proxy, making it impossible to use the app from countries like mine.

Possible Implementation

kingofnull commented 5 days ago

Just set proxy before running spotDL , only http proxy is supported.

Windows:

set http_proxy=http://127.0.0.1:8000
spotDL https://open.spotify.com/playlist/20qc2TEShaQKMutv8qb1gf

Linux :

export https_proxy=http://127.0.0.1:8000
spotDL https://open.spotify.com/playlist/20qc2TEShaQKMutv8qb1gf

Linux single line :

https_proxy=http://127.0.0.1:8000 spotDL https://open.spotify.com/playlist/20qc2TEShaQKMutv8qb1gf
xnetcat commented 5 days ago

Like @kingofnull said use env variables for proxy.

https://requests.readthedocs.io/en/latest/user/advanced/#proxies

Better proxy support maybe in the future