Base 6 4 ta pu ni chi a ku n (lol)

Finds base64encoded and automatically decode

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Base 6 4 ta pu ni chi a ku n (lol)
// @namespace    https://twitter.com/
// @version      0.1
// @description  Finds base64encoded and automatically decode
// @author       6 4 ta pu ni chi a ku n ro yal lol
// @match https://twitter.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const root = document.getElementById("react-root");

    setInterval(() => {
        const tweets = root.querySelectorAll("article div[dir][lang]:not(.base64-decoded)");

        for (let tweet of tweets) {
            const text = tweet.textContent;
            const match = text.match(/[0-9A-Za-z+\/=]{8,}/);
            if (match && match[0].length * 2 > text.length) {
                let data = match[0];
                try { // repeat decoding
                    for (;;) {
                        data = atob(data);
                    }
                } catch(e) {}
                if (/[\x80-\xff]/.test(data)) { // UTF-8
                    data = new TextDecoder().decode(new Uint8Array(data.split("").map(c => c.charCodeAt())));
                }
                const decoded = document.createElement("div");
                decoded.style.color = "green";
                decoded.textContent = data;
                tweet.insertAdjacentElement("afterend", decoded);
            }
            tweet.classList.add("base64-decoded");
            // 6 4 た ぷ に き あ く ん 笑
        }
    }, 5000);

})();