Advertisement
Guest User

Teddit 429 Handler

a guest
Jul 14th, 2023
1,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           teddit429Handler
  3. // @namespace      https://teddit.net
  4. // @version        1.0.0
  5. // @description    teddit 429 handler
  6. // @author         bezier-curve
  7. // @include        http*://teddit.net/*
  8. // @include        http*://teddit.hostux.net/*
  9. // @include        http*://reddit.lol/*
  10. // @include        http*://teddit.artemislena.eu/*
  11. // @include        http*://teddit.rawbit.ninja/*
  12. // @include        http*://td.vern.cc/*
  13. // @include        http*://teddit.privacytools.io/*
  14. // @include        http*://teddit.garudalinux.org/*
  15. // @include        http*://i.opnxng.com/*
  16. // @include        http*://teddit.bus-hit.me/*
  17. // @include        http*://teddit.adminforge.de/*
  18. // @include        http*://teddit.sethforprivacy.com/*
  19. // @include        http*://teddit.pussthecat.org/*
  20. // @include        http*://incogsnoo.com/*
  21. // @include        http*://discuss.whatever.social/*
  22. // @include        http*://teddit.zaggy.nl/*
  23. // @run-at         document-end
  24. // @grant unsafeWindow
  25. // ==/UserScript==
  26.  
  27. const retryCodes = [
  28.   "429",
  29.   "403",
  30. ];
  31.  
  32. const workingInstances = [
  33.   "teddit.hostux.net",
  34.   "teddit.net",
  35.   // "reddit.lol",
  36.   "teddit.artemislena.eu",
  37.   "teddit.rawbit.ninja",
  38.   "td.vern.cc",
  39.   "teddit.privacytools.io",
  40.   "teddit.garudalinux.org",
  41.   "i.opnxng.com",
  42.   "teddit.bus-hit.me",
  43.   "teddit.adminforge.de",
  44.   "teddit.sethforprivacy.com",
  45.   "teddit.pussthecat.org",
  46.   "incogsnoo.com",
  47.   "discuss.whatever.social",
  48.   "teddit.zaggy.nl",
  49. ];
  50.  
  51. window.addEventListener('load', () => {
  52.   const window = unsafeWindow;
  53.  
  54.   setTimeout(() => {
  55.     const errorCodeP = document.querySelector("body > .reddit-error > p:nth-child(2)");
  56.  
  57.     if (errorCodeP && retryCodes.includes(errorCodeP.innerText.trim())) {
  58.       let nextInstance;
  59.  
  60.       while ((nextInstance = workingInstances[Math.floor(Math.random() * workingInstances.length)]) === window.location.host) {}
  61.  
  62.       window.location.href = window.location.href.replace(new RegExp(window.location.host), nextInstance);
  63.     }
  64.   }, 1000);
  65. });
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement