Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use proxies (HTTP(s) & socks) #301

Closed
dimqua opened this issue Jan 19, 2019 · 22 comments
Closed

Allow to use proxies (HTTP(s) & socks) #301

dimqua opened this issue Jan 19, 2019 · 22 comments
Labels
enhancement Improvement of an existing feature

Comments

@dimqua
Copy link
Contributor

dimqua commented Jan 19, 2019

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.

@Perflyst
Copy link
Contributor

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.

@omarroth omarroth added the enhancement Improvement of an existing feature label Feb 7, 2019
@Nutomic
Copy link

Nutomic commented Mar 7, 2019

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.

@omarroth
Copy link
Contributor

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.

@leonklingele
Copy link
Contributor

Running the invidious binary with torsocks should proxy requests through Tor.

@rakamanja
Copy link

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:

  1. Run it on a VM an route all the VM's traffic through tor;
  2. 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.

@kVxQeXZbQAufBnQqA
Copy link

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.

@somebody-somewhere-over-the-rainbow

This comment has been minimized.

@unixfox unixfox changed the title Allow to proxify request to YouTube Allow to use proxies (HTTP(s) & socks) Jul 5, 2021
@JuniorJPDJ

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Aug 7, 2022

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.

@github-actions github-actions bot added the stale label Aug 7, 2022
@pickinanameainteasy
Copy link

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

@unixfox
Copy link
Member

unixfox commented Jul 10, 2023

Candidate libraries:

socks

http

@SamantazFox I think in the lights of #3822, this issue should be our main priority to more easily bypass YouTube restrictions.

@syeopite
Copy link
Member

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.

@unixfox
Copy link
Member

unixfox commented Aug 27, 2023

@syeopite very good, I think that was a big missing piece in the puzzle for trying to solve the geo-restrictions: #92

@mk-pmb
Copy link

mk-pmb commented Dec 29, 2023

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! 👍

@unixfox
Copy link
Member

unixfox commented Nov 1, 2024

Closing as #4270 was merged.

@johnwmail

This comment was marked as off-topic.

@unixfox

This comment was marked as off-topic.

@mk-pmb

This comment was marked as off-topic.

@unixfox

This comment was marked as off-topic.

@johnwmail

This comment was marked as off-topic.

@unixfox
Copy link
Member

unixfox commented Nov 13, 2024

Because I don't want to clutter this issue with YAML basic issues, I'm going to lock this issue since this bug has been solved. Please continue the discussion on matrix or IRC thank you: https://matrix.to/#/#invidious:matrix.org or https://web.libera.chat/?channel=#invidious

@iv-org iv-org locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

16 participants