Automatic Redlib Quota & Error Redirector

Automatically redirects to another Redlib (previously Libreddit) instance if the one you're directed to has reached its rate limit/quota or has an error.

当前为 2024-03-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Automatic Redlib Quota & Error Redirector
  3. // @namespace happyviking
  4. // @version 1.50.0
  5. // @grant none
  6. // @run-at document-end
  7. // @license MIT
  8. // @description Automatically redirects to another Redlib (previously Libreddit) instance if the one you're directed to has reached its rate limit/quota or has an error.
  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.eu.org/*
  16. // @match https://libreddit.privacydev.net/*
  17. // @match https://libreddit.projectsegfau.lt/*
  18. // @match https://lr.n8pjl.ca/*
  19. // @match https://r.darrennathanael.com/*
  20. // @match https://red.artemislena.eu/*
  21. // @match https://red.ngn.tf/*
  22. // @match https://reddit.idevicehacked.com/*
  23. // @match https://reddit.invak.id/*
  24. // @match https://reddit.owo.si/*
  25. // @match https://redlib.catsarch.com/*
  26. // @match https://redlib.dnfetheus.xyz/*
  27. // @match https://redlib.ducks.party/*
  28. // @match https://redlib.freedit.eu/*
  29. // @match https://redlib.perennialte.ch/*
  30. // @match https://redlib.tux.pizza/*
  31. // @match https://redlib.vimmer.dev/*
  32. // @match https://rl.bloat.cat/*
  33. // @match https://safereddit.com/*
  34. // @match https://redlib.nohost.network/*
  35. // @match https://redlib.r4fo.com/*
  36. // @match https://redlib.xn--hackerhhle-kcb.org/*
  37. // @match https://eu.safereddit.com/*
  38. // @match https://redlib.matthew.science/*
  39. // @match https://libreddit.freedit.eu/*
  40. // @match https://libreddit.hu/*
  41. // @match https://libreddit.kylrth.com/*
  42. // @match https://libreddit.lunar.icu/*
  43. // @match https://libreddit.mha.fi/*
  44. // @match https://libreddit.northboot.xyz/*
  45. // @match https://libreddit.oxymagnesium.com/*
  46. // @match https://libreddit.pussthecat.org/*
  47. // @match https://libreddit.spike.codes/*
  48. // @match https://libreddit.strongthany.cc/*
  49. // @match https://libreddit.tiekoetter.com/*
  50. // @match https://lr.4201337.xyz/*
  51. // @match https://lr.aeong.one/*
  52. // @match https://lr.artemislena.eu/*
  53. // @match https://lr.slipfox.xyz/*
  54. // @match https://r.walkx.fyi/*
  55. // @match https://reddit.rtrace.io/*
  56. // @match https://reddit.simo.sh/*
  57. // @match https://reddit.smnz.de/*
  58. // @match https://reddit.utsav2.dev/*
  59. // @match https://snoo.habedieeh.re/*
  60. // @match https://libreddit.kutay.dev/*
  61. // @match https://libreddit.tux.pizza/*
  62. // @match https://lr.vern.cc/*
  63. // @match https://r.darklab.sh/*
  64. // @match https://reddit.leptons.xyz/*
  65. // @match https://discuss.whatever.social/*
  66. // @match https://libreddit.kavin.rocks/*
  67. // @match https://libreddit.cachyos.org/*
  68. // @match https://libreddit.domain.glass/*
  69. // @match https://libreddit.privacy.com.de/*
  70. // @match https://reddit.baby/*
  71. // <<INSTANCES END HERE>>
  72.  
  73. // ==/UserScript==
  74.  
  75. function main() {
  76. const errorElement = document.getElementById("error")
  77. if (!errorElement) return;
  78. const errorMessage = errorElement.querySelector("h1")?.innerHTML
  79. if (!errorMessage) return
  80. if (errorMessage.includes("Too Many Requests") ||
  81. errorMessage.includes("Failed to parse page JSON data")){
  82. const addedMessage = document.createElement("p")
  83. addedMessage.textContent = "Redirecting you to new instance..."
  84. errorElement.appendChild(addedMessage)
  85. location.replace('https://farside.link/redlib/' + window.location.pathname + window.location.search);
  86. }
  87. }
  88.  
  89. main()
  90.