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

random.invidious.io (automatically redirect to random instance) #46

Closed
wants to merge 1 commit into from

Conversation

girst
Copy link

@girst girst commented Jan 26, 2024

Hi all,

This is a proposal for improving the instances-api. For any URL that's not an instances-api endpoint, it redirects the user to a random instance. This is useful for sharing links with people who don't have a redirection extension installed; something that was requested before at iv-org/invidious-redirect#17.

I did not go all the way for this prototype, but I wanted to point out that its possible to filter which instances one is picked from. Adding ?iv-region=XX is hopefully obvious; ?iv-health=99 limits to only instances with at least 99% uptime (the default value if none was chosen is 95%). Also, it detects API requests and chooses from only instances with API enabled when necessary. This could be extended if needed.

Note that for this version I decided to sniff the hostname and only enable this feature when it is random.invidious.io - not sure if such a restriction is necessary or useful; feel free to rip it out.

automatically redirects requests to a random, healthy instance. the user
may specify which region the instance should be from by setting the
iv-region query parameter and the minimum 30 day uptime in percent with
iv-health query parameter. if no instance matching these parameters can
be found, a 404 error is returned instead.

note that this behaviour is only enabled for the magic hostname
'random.invidious.io' in order to not send traffic to instances unless
explicitly requested.
@syeopite
Copy link
Member

This already exists in the form of redirect.invidious.io though it is not automatic

@girst
Copy link
Author

girst commented Jan 27, 2024 via email

@unixfox
Copy link
Member

unixfox commented Jan 29, 2024

Not sure though about this new feature because this functionality already exists, and it's called farside: https://github.com/benbusby/farside

Example: https://farside.link/invidious

@TheFrenchGhosty
Copy link
Member

This it out of scope for api.invidious.io

This is something I've been planning to implement using https://gitlab.com/gaincoder/invidious-router (or maybe a custom farside)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants