Automatic Libreddit Quota Redirector

Automatically redirects to another Libreddit instance if the one you're directed to has reached its rate limit/quota.

目前为 2023-08-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Automatic Libreddit Quota Redirector
  3. // @namespace happyviking
  4. // @version 1.30.0
  5. // @grant none
  6. // @run-at document-end
  7. // @license MIT
  8. // @description Automatically redirects to another Libreddit instance if the one you're directed to has reached its rate limit/quota.
  9. // @icon https://gitlab.com/uploads/-/system/project/avatar/32545239/libreddit.png
  10. // @author HappyViking
  11.  
  12. // <<INSTANCES START HERE>>
  13. // @match https://l.opnxng.com/*
  14. // @match https://libreddit.bus-hit.me/*
  15. // @match https://libreddit.kutay.dev/*
  16. // @match https://libreddit.lunar.icu/*
  17. // @match https://libreddit.mha.fi/*
  18. // @match https://libreddit.privacy.com.de/*
  19. // @match https://libreddit.privacydev.net/*
  20. // @match https://libreddit.tux.pizza/*
  21. // @match https://lr.4201337.xyz/*
  22. // @match https://lr.aeong.one/*
  23. // @match https://lr.artemislena.eu/*
  24. // @match https://lr.vern.cc/*
  25. // @match https://r.darklab.sh/*
  26. // @match https://reddit.baby/*
  27. // @match https://reddit.invak.id/*
  28. // @match https://reddit.leptons.xyz/*
  29. // @match https://reddit.smnz.de/*
  30. // @match https://safereddit.com/*
  31. // @match https://snoo.habedieeh.re/*
  32. // <<INSTANCES END HERE>>
  33.  
  34. // ==/UserScript==
  35.  
  36. function main() {
  37. const errorMessage = document.getElementById("error")
  38. if (!errorMessage) return;
  39. if(!errorMessage.querySelector("h1")?.innerHTML.includes("Too Many Requests")) return;
  40. const addedMessage = document.createElement("p")
  41. addedMessage.textContent = "Redirecting you to new instance..."
  42. errorMessage.appendChild(addedMessage)
  43. location.replace('https://farside.link/libreddit/' + window.location.pathname);
  44. }
  45.  
  46. main()
  47.