spotube icon indicating copy to clipboard operation
spotube copied to clipboard

Add proxy support

Open awohsen opened this issue 2 years ago • 60 comments

Is your feature request related to a problem? Please describe. Since I can't connect to many platforms because of censorship, I always use the proxy settings; but IDK where to implement them here!

awohsen avatar May 23 '22 17:05 awohsen

same here, from China mainland.

Jack-Chou-HZ avatar Jun 03 '22 01:06 Jack-Chou-HZ

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

KRTirtho avatar Jun 03 '22 03:06 KRTirtho

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

https://github.com/Sangwan5688/BlackHole/search?q=proxy&type=commits, but this is http proxy only, while many users would prefer a socks one

momobobe avatar Jun 05 '22 07:06 momobobe

Disclamer: I have no idea what I'm doing, I'm not familiar with flutter I've made a spotube-socks5 demo, it has hardcoded local socks5 proxy. I have no idea how to add a settings menu for proxy, so I'll just leave it here in hopes that this would help. I works globally within the app.

Package used: flutter_socks_proxy [MIT license]

0x07C0 avatar Jul 12 '22 14:07 0x07C0

For Linux users, there is an option to run spotube using proxychains tool and it will tunnel the application through a custom proxy

awohsen avatar Aug 27 '22 12:08 awohsen

Sorry bro.. Forgot to add this feature request to Todo

KRTirtho avatar Aug 27 '22 14:08 KRTirtho

spotify has left my country, so im w8 so much for proxy support in spotube

I kind of have no idea how proxy works because I never had to use it. If anyone of you are experienced with proxy & flutter please share

its easy to implement proxy via http CONNECT https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling idk dart lang, but there is a pseudocode example:

function http.proxyRequest(proxy, request)
	connection = http.connect(proxy.host, proxy.port, proxy.tls)

	connection.write("CONNECT", {
		["Host"] = request.host,
		["Proxy-Authorization"] = proxy.credentials
	})

	response = connection.read()

	if response and response.code == 200 then
		connection.host = request.host
		connection.port = request.port
		connection.tls = request.tls

		connection.write(request.method, request.headers, request.body)

		return connection.read()
	else
		retry with another proxy...
	end
end

Be1zebub avatar May 21 '23 00:05 Be1zebub

hi thanks for write this application please if it possible set upper priority for this option in many country spotify is block thanks

mohammadRezaeian avatar May 21 '23 20:05 mohammadRezaeian

I'd love to add this feature but I'm just not sure how to approach it. Looking for an expert on this topic for months :)

KRTirtho avatar May 22 '23 03:05 KRTirtho

I think this is no longer required/valid as Spotube now uses piped API which is accessible globally

If the default server API (kavin.rocks) is not available in your region you can change it from "Settings" > "Piped Server Instance" selector You can find which server is closer to your region in Piped Wiki

KRTirtho avatar Jun 25 '23 08:06 KRTirtho

i have no "Piped Server Instance" in settings, is this feature released?

screenshots

Be1zebub avatar Jun 25 '23 14:06 Be1zebub

It's available in nightly release

KRTirtho avatar Jun 25 '23 15:06 KRTirtho

login is not proxied
ok, then I tried to login with my http proxy server - i got 403 (login in browser spotify app works ok) seems like when i try with my own proxy spotube login button still opens https://www.spotify.com/int/why-not-available/ because in browser when proxy enabled on this page i got 403 too, like in spotube login i think its cached?

Be1zebub avatar Jun 25 '23 19:06 Be1zebub

Please allow using a custom Piped instance like how Libretube handles that.

mohammadrafigh avatar Aug 11 '23 02:08 mohammadrafigh

I have the 403 issue too, maybe you can make that the login instance opens in the default browser. Idk if it's possible but i think that it would solve the problem

spl3g avatar Aug 30 '23 23:08 spl3g

"login instance opens in the default browser" - yep this would allow to proxy browser http requests and pass the login stage, rn the application is just useless in countries where spotify left :(

Be1zebub avatar Aug 31 '23 00:08 Be1zebub

Or it will be great to give a choice between the in app browser and the cookie method (like in the pc version).

spl3g avatar Aug 31 '23 16:08 spl3g

same here, from China mainland.

same here, from Iran.

xmha97 avatar Oct 06 '23 00:10 xmha97

Piped Server Instance

Screenshot_2023-11-21-12-00-12-108_oss krtirtho spotube

I can't access github in my region, reading the online Piped Server Instance fails.😂

As well as I can build my own piped server, hopefully I can customize the input server address.

Cp0204 avatar Nov 21 '23 04:11 Cp0204

I can't access github in my region, reading the online Piped Server Instance fails.😂

Dang it. I should've thought of it earlier. I'll provide some default server list and also a field to manually add a Piped instance url

KRTirtho avatar Dec 15 '23 12:12 KRTirtho

@KRTirtho I noticed that even if we use a custom Piped instance Spotube fetches playlists and track info from Spotify which is also blocked in many countries and the Spotube is not able to fetch those data so the app won't work at all. Maybe there should be some sort of local caching at least for user playlists, So without any proxy we can play our own playlists using a custom piped instance.

I'm thinking of better solutions to handle that, maybe something like piped API but just to fetch info and playlists from Spotify.

mohammadrafigh avatar Dec 15 '23 12:12 mohammadrafigh

You can use VPN probably

dave9123 avatar Dec 19 '23 12:12 dave9123

I'd love to add this feature but I'm just not sure how to approach it. Looking for an expert on this topic for months :)

Probably check if the proxy is selected and check if the proxy is accessible, then another check if proxy is enabled and is accessible use it for query and download

dave9123 avatar Dec 19 '23 12:12 dave9123

It seems the http client limit on dart, maybe we can try some solution from https://github.com/flutter/flutter/issues/26359

rockxsj avatar Jan 02 '24 05:01 rockxsj

You can use the terminal proxy

export https_proxy=http://127.0.0.1:$port;export http_proxy=http://127.0.0.1:$port;export all_proxy=socks5://127.0.0.1:$port

, then open spotube application in terminal

/Applications/spotube.app/Contents/MacOS/spotube

don't close termainal.

LiZhenchong avatar Jan 03 '24 06:01 LiZhenchong

You can use the terminal proxy

export https_proxy=http://127.0.0.1:$port;export http_proxy=http://127.0.0.1:$port;export all_proxy=socks5://127.0.0.1:$port

, then open spotube application in terminal

/Applications/spotube.app/Contents/MacOS/spotube

don't close termainal. use this command open can close terminal

 nohup /Applications/spotube.app/Contents/MacOS/spotube &

LeeDF avatar Jan 03 '24 09:01 LeeDF

You can use the terminal proxy

export https_proxy=http://127.0.0.1:$port;export http_proxy=http://127.0.0.1:$port;export all_proxy=socks5://127.0.0.1:$port

, then open spotube application in terminal

/Applications/spotube.app/Contents/MacOS/spotube

don't close termainal.

it is work well under windows

rockxsj avatar Jan 03 '24 11:01 rockxsj

You can use the terminal proxy

export https_proxy=http://127.0.0.1:$port;export http_proxy=http://127.0.0.1:$port;export all_proxy=socks5://127.0.0.1:$port

, then open spotube application in terminal

/Applications/spotube.app/Contents/MacOS/spotube

don't close termainal. use this command open can close terminal

 nohup /Applications/spotube.app/Contents/MacOS/spotube &

It works very well, thanks!

Monster12138 avatar Jan 12 '24 09:01 Monster12138

Is there any progress now? I am a Windows user/

Leroy-X avatar Jan 23 '24 08:01 Leroy-X

windows user in mainland China, hoping for socks5 support.

wuyuansheng1982 avatar Jan 25 '24 05:01 wuyuansheng1982