Guest User

Untitled

a guest
Nov 27th, 2023
4,612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. // ==UserScript==
  2. // @name FMHY Decoder
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Decode Base64 encoded links from the https://fmhy.pages.dev/
  6. // @author FMHY
  7. // @match https://fmhy.net/base64*
  8. // @match https://fmhy.pages.dev/base64*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{20,})$/g
  16.  
  17. // Must set an interval, otherwise the content that is lazy loaded (e.g. loaded on scrolling) will not get decoded
  18. setInterval(() => {
  19. const pTags = document.querySelectorAll('p')
  20.  
  21. pTags.forEach(pTag => {
  22. // Split the string into an array and check each element for a base64 encoded string
  23. const pTagText = pTag.innerText.split(/\s+/);
  24.  
  25. pTagText.forEach(text => {
  26. if (base64Regex.test(text)) {
  27. // If the string is a base64 encoded string, decode it and replace the p tag with the decoded string
  28. pTag.innerText = pTag.innerText.replace(text, atob(text));
  29. const txt = pTag.innerText.split("\n");
  30. const links = [];
  31. txt.forEach(link => {
  32. links.push("<a href='" + link + "'>" + link + "</a>");
  33. });
  34. pTag.outerHTML = links.join("\n");
  35. }
  36. });
  37. })
  38. }, 500)
  39. })();
Add Comment
Please, Sign In to add comment