iheanyi / bandcamp-dl

Simple python script to download Bandcamp albums
The Unlicense
956 stars 108 forks source link

SOCKS proxy support #191

Open pooyangoodarzi opened 2 years ago

pooyangoodarzi commented 2 years ago

Access to the Bandcamp website is banned in my country(Yes, I live in such a hell). Therefore the Bandcamp-dl cannot do anything and just waits until the whole process is timed out. The same thing happens to the youtube-dl, but youtube-dl supports SOCKS proxies, and I can give it the proxies that I have as an option to the command. It will be beneficial if Bandcamp-dl adds the support for proxies too.

Evolution0 commented 2 years ago

Looks straightforward enough, just a matter of giving the option to pass the proxies on run, something like: --proxies="httpurl, httpsurl" and if provided use them in the GET requests.

This does pull in optional dependencies that 95% of users likely won't need so I have to figure out if I want to add it as a hard requirement by pulling requests[socks] in or add the option when installing bandcamp-dl itself. (IE pip install bandcamp-downloader[socks])

It will be in the next release, of that you can be sure.

snylonue commented 2 years ago

requests, the network library bandcamp-dl uses, supports SOCKS with required dependencies installed by python -m pip install requests[socks]. Proxy will be used when HTTP_PROXY, HTTPS_PROXY or ALL_PROXY is set, e.g. ALL_PROXY=socks5://127.0.0.1:1080 bandcamp-dl https://mikazukibigwave.bandcamp.com/album/romantic-album

Evolution0 commented 2 years ago

requests, the network library bandcamp-dl uses, supports SOCKS with required dependencies installed by python -m pip install requests[socks]. Proxy will be used when HTTP_PROXY, HTTPS_PROXY or ALL_PROXY is set, e.g. ALL_PROXY=socks5://127.0.0.1:1080 bandcamp-dl https://mikazukibigwave.bandcamp.com/album/romantic-album

Yep, I was aware it was supported but not that just setting a few environment variables was all that was needed for setup.

May be better if sooner rather than later bandcamp-dl gets config file support.