-
Notifications
You must be signed in to change notification settings - Fork 25
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
Redirect to random healthy instance #6
Labels
enhancement
New feature or request
Comments
Created proof-of-concept redirect in rustlang that doesn't depend on javascript use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer, Responder};
async fn redirect() -> impl Responder {
HttpResponse::MovedPermanently()
.set_header(
actix_web::http::header::LOCATION,
"https://snopyta.org",
)
.finish()
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.route("/", web::get().to(redirect))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
} |
Doable with Tampermonkey script for now: // ==UserScript==
// @name Redirect Invidious Feeling Lucky
// @description Redirect to random Invidious instance that has 100% uptime when visiting redirect.invidious.io
// @namespace http://tampermonkey.net/
// @version 2024-05-13
// @author sethidden
// @match https://redirect.invidious.io/*
// @grant none
// ==/UserScript==
const interval = setInterval(() => {
const table = [...document.querySelector('tbody').children];
if(table[0].className === 'loading') return;
clearInterval(interval);
const buttonsWith100Uptime = table
.reduce(
(acc, { children: [,,health,buttonContainer] }) =>
health.textContent === "100"
? [...acc, buttonContainer.children[0]]
: acc,
[]
)
const randomIndex = Math.floor(Math.random()*1000 % buttonsWith100Uptime.length);
buttonsWith100Uptime[randomIndex].click();
}, 200) then go to e.g.: https://redirect.invidious.io/search?q=chocolate+rain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've noticed a few instances going offline or slowing down substantially over the last few weeks, and I suspect it might be because users are picking the top healthy instance on the current redirect page. This surge may resource/load issues on that one instance.
What if this redirected to a random healthy instance that would have normally been shown towards the top of the list on the page today? This could be something similar, in theory, to how other load balancers work.
If you still wanted to show a list so users could manually override this behavior, show the current list with a timed redirect to a random instance after some number of seconds. (this particular part might not work without JS though..?)
The text was updated successfully, but these errors were encountered: