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

Idea: Select Invidious instance at random #149

Closed
ndren opened this issue Jul 28, 2023 · 1 comment · Fixed by #150
Closed

Idea: Select Invidious instance at random #149

ndren opened this issue Jul 28, 2023 · 1 comment · Fixed by #150
Labels
enhancement Improves an existing feature

Comments

@ndren
Copy link
Contributor

ndren commented Jul 28, 2023

Summary

If the Invidious instance was selected at random, failures in one would not break jimmi.xyz entirely. This is very easy to add in the current code without any complicated rearchitecturing.

Motivation

When an instance gets rate limited (like what happened to the current one) there's a 0% chance !play will work. If more instances are added this lower bound can be increased a lot.

Additional information

I can code this myself, but I don't have a node development setup so I cannot test what I write. It could be as simple as

function randomChoice(arr) {
    return arr[Math.floor(arr.length * Math.random())];
}
function baseUrl() {
  return randomChoice(["https://vid.puffyan.us", "https://yewtu.be", "https://yt.artemislena.eu"]) // Include other instances that have a tick in API in https://api.invidious.io/ (allowed API access)
}

And then use this.baseUrl() when fetching.

@ndren ndren added the enhancement Improves an existing feature label Jul 28, 2023
@p-fruck
Copy link
Member

p-fruck commented Jul 29, 2023

This is something we considered previously and which should be part of #69 (EPYC to refactor everything YouTube related into its own reusable module).

The consideration was to not only select instances at random, but rather give the user full choice of which invidious instance to use, so that users could also provide their self-hosted instances.

I currently do not have the time to develop this feature myself, but if you have the time to setup a development environment and test your changes I'd be happy to welcome a PR ;)

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

Successfully merging a pull request may close this issue.

2 participants