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-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Automatic Libreddit Quota Redirector
  3. // @namespace happyviking
  4. // @version 1.26.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://libreddit.bus-hit.me/*
  14. // @match https://libreddit.freedit.eu/*
  15. // @match https://libreddit.oxymagnesium.com/*
  16. // @match https://libreddit.privacy.com.de/*
  17. // @match https://libreddit.privacydev.net/*
  18. // @match https://libreddit.tux.pizza/*
  19. // @match https://lr.4201337.xyz/*
  20. // @match https://lr.aeong.one/*
  21. // @match https://lr.vern.cc/*
  22. // @match https://r.darklab.sh/*
  23. // @match https://reddit.baby/*
  24. // @match https://reddit.invak.id/*
  25. // @match https://reddit.leptons.xyz/*
  26. // @match https://safereddit.com/*
  27. // @match https://snoo.habedieeh.re/*
  28. // <<INSTANCES END HERE>>
  29.  
  30. // ==/UserScript==
  31.  
  32. function main() {
  33. const errorMessage = document.getElementById("error")
  34. if (!errorMessage) return;
  35. if(!errorMessage.querySelector("h1")?.innerHTML.includes("Too Many Requests")) return;
  36. const addedMessage = document.createElement("p")
  37. addedMessage.textContent = "Redirecting you to new instance..."
  38. errorMessage.appendChild(addedMessage)
  39. location.replace('https://farside.link/libreddit/' + window.location.pathname);
  40. }
  41.  
  42. main()
  43.