invidious
invidious copied to clipboard
Allow to use proxies (HTTP(s) & socks)
This could be useful for those having a self-hosted instance. The idea is about adding an option to specify a proxy server (e.g. tor socks proxy), which can be used when a server are going to make a request to YouTube to fetch the data.
Maybe it is also possible to proxy the youtube media through the server itself so that the users ip address is hidden to google. If this will be done, maybe also add the option to enable/disable this feature, because some hosters have traffic limit on their servers.
I honestly thought this is what invidious does. I was a bit surprised that it still connects me directly to youtube. This should definitely be possible, at least with self-hosting.
To be clear, the instance itself proxies requests, and then uses a proxy in another region as necessary to circumvent geo-restrictions (see #92). See my comment here for some clarification on what Invidious does.
There appears to be a socks shard that should make this possible, I'll have to look more into it to ensure it can be used here.
Running the invidious binary with torsocks
should proxy requests through Tor.
I wish I could have replied to this earlier but our microsoft overlords decided they don't like my ISP.
torsocks
overwrites calls to libc
functions. Therefore it only works if your software is using libc. I believe the crystal network library is not implemented on top if libc
, but I haven't tested nor do I know crystal. Source on that information (second and third paragraphs): https://gitweb.torproject.org/torsocks.git/tree/README.md
If this information is correct, the best way to tunnel the requests of your local instance through tor would be to either:
- Run it on a VM an route all the VM's traffic through tor;
- Run invidious under a dedicated user and use iptables to redirect every package from that user through a transparent proxy. In that case you have to make sure that your system is not using your ISP's DNS servers.
It seems this issue has not received much attention. I would like to explore using the sox shard, previously called "socks". My main worry with implementing this is that Google generally does not like IP addresses of Tor exit nodes and will either completely block these addresses or result in an endless Captcha loop.
as a private self-hoster of an instance I would love to run the requests to youtube/google also via a socks proxy. Would be awesome!
Bump, it's very cool idea and would make configuring VPN to access youtube on server-side easy to do.
This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.
Is it possible to proxy requests to YouTube by connecting to tor, then connect to privoxy?
Maybe using this container (https://hub.docker.com/r/dockage/tor-privoxy#!) And having the invidious container depend on this one
Candidate libraries:
socks
- https://github.com/636f7374/socks.cr (latest update 2022 - under construction - seems unmaintained)
- https://github.com/636f7374/herbal.cr (latest update 2021 - seems unmaintained)
- https://github.com/jkthorne/sox (latest update 2020 - seems unmaintained)
http
- https://github.com/mamantoha/http_proxy (latest update 3 weeks ago - seems maintained)
- https://github.com/spider-gazelle/connect-proxy (latest update 2022 - seems unmaintained)
- https://github.com/636f7374/connect.cr (latest update 2022 - seems unmaintained)
- https://github.com/636f7374/carton.cr (latest update 2021 - seems unmaintained)
@SamantazFox I think in the lights of #3822, this issue should be our main priority to more easily bypass YouTube restrictions.
Still a work in progress but here's HTTP proxy support through the http_proxy
shard:
https://github.com/syeopite/invidious/tree/http-proxy
It works although InnerTube requests aren't proxied for some reason but /videoplayback
and related endpoints are. Still, this should allow us to bypass YouTube's blockage more easily seeing as they're mostly restricting access to the streaming urls.
To use just set at least the host
and port
configuration here.
##
## Configuration for using a HTTP proxy
##
## If unset, then no HTTP proxy will be used.
##
http_proxy:
user:
password:
host:
port:
I haven't tested every edge case but it seems to be stable.
@syeopite very good, I think that was a big missing piece in the puzzle for trying to solve the geo-restrictions: https://github.com/iv-org/invidious/issues/92
Can we make it so it uses the https_proxy
env var passed to the docker image?
Also you may want to update INVIDIOUS_CONFIG
in docker-compose.yml
.
Edit: Also if I remove the user and password config line, I get an error Unhandled exception: Couldn't parse (HTTPProxyConfig | Nil) at line 14, column 3 (YAML::ParseException)
. Maybe you could make them entirely optional?
Edit 2: I got it to work now. First time I can actually run my own invidious. Good work! 👍