심야식당 자동복호화

심야식당내 base64코드 자동복호화

目前为 2022-03-18 提交的版本。查看 最新版本

// ==UserScript==
// @name         심야식당 자동복호화
// @namespace    http://tampermonkey.net/
// @version      0.214
// @description  심야식당내 base64코드 자동복호화
// @author       SYJ
// @match        https://arca.live/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arca.live
// @grant        none
// @require http://code.jquery.com/jquery-3.6.0.min.js
// @license MIT
// ==/UserScript==

(function() {
    //'use strict';

    let txt=$('.article-content').text();

    let regex=/[0-9A-Za-z]{30,}[=]{1,2}/;
    let matched_txt=regex.exec(txt);
    while (matched_txt != null){

    let coded_txt=matched_txt[0];
    if (coded_txt.slice(0,4) == 'html')
    {
        coded_txt=coded_txt.slice(4,);
    }
    let decoded_txt=coded_txt;

    while (1)
    {
        decoded_txt=atob(decoded_txt);
        if ( decoded_txt.slice(-1) != '=')
        {
            break;
        }
    }

    decoded_txt =decoded_txt+'\n';
    console.log(decoded_txt);
    function getElementByXpath(path) {
  return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
    }
    let z=getElementByXpath("//p[contains(text(),'"+coded_txt+"')]");
    console.log(z.textContent);
    z.innerHTML="<a href='"+decoded_txt+"'>"+ decoded_txt +"</a>";
    //z.textContent=z.textContent.replace(regex,decoded_txt)
    console.log(z.textContent)
        txt=$('.article-content').text();
        matched_txt=regex.exec(txt);
    }

})();