Extract RHYTHM-play arcaea password from video

Read cards in the video for you

/* eslint-disable no-multi-spaces */
/* eslint-disable no-return-assign */

// ==UserScript==
// @name               Extract RHYTHM-play arcaea password from video
// @namespace          https://greasyfork.org/users/667968-pyudng
// @version            0.1
// @description        Read cards in the video for you
// @author             PY-DNG
// @license            Do What The F*ck You Want To Public License
// @match              *://www.youtube.com/*
// @require            https://update.greasyfork.org/scripts/456034/1348286/Basic%20Functions%20%28For%20userscripts%29.js
// @icon               data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgsKAg4KCA0OCg0LChAKCggLDRALDwgJDwgKDQoNCgoICgoNCwoNDQoODQoLDQgKCw0OCgkNDQ8IDQsICggBAwQEBgUGCgYGChENCw0QEBAQDxAPEA8PEBAPDw8NEBAPDg0NDQ0PDRAQDw8PDQ8PDQ0QDw8PDw0PDQ0NEA0PDv/AABEIAFgAWAMBEQACEQEDEQH/xAAdAAADAQADAAMAAAAAAAAAAAAGBwgEAgMFAAEJ/8QAPRAAAgIAAwcCAwYEAgsAAAAAAQIDEQQSIQAFBgcTIjFBURQyYQgjQlJxgRVikaGi0RYXJTNyc4KDsbPw/8QAGwEAAQUBAQAAAAAAAAAAAAAABAACAwUGBwH/xAA2EQABBAADBAgEBgIDAAAAAAABAAIDEQQhMQUSQVETImFxgZGxwaHR4fAGFDJCgvEjcpKywv/aAAwDAQACEQMRAD8A/TBm2iVuuDjZJwXxdkvFi3rvJY8EXc0qgsx9gNkpo2F5DRmTkFJ3Pz7TfRhypmtiKjQWY0JFs6sVGeryo5FkGxXaB3SC6Oi6Zs38MSyMJYAXgXnp9Ty4X5r0eEOc2CwvBaYmN/iWlIVEWjLJMb7GQ0Vca2pChB+QAVO0tcLGiqH7OxMk5wz2lrhregHM9nKrvgsnGm+N4T7/AI5R0oqUkxKM6wR6GTqzOpvMBlZlRQ1UUdcwLgTorNmx8FudZ77GXCyewfXxRnwzx9AMESxl+J7TMi07QLlVYxngRIxERTQWB1VJ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UE/NxYit3gD02csfJ+pf/Z
// @grant              GM_registerMenuCommand
// @run-at             document-start
// ==/UserScript==

/* global LogLevel DoLog Err $ $All $CrE $AEL $$CrE addStyle detectDom destroyEvent copyProp copyProps parseArgs escJsStr replaceText getUrlArgv dl_browser dl_GM AsyncManager queueTask testChecker registerChecker loadFuncs */

(function __MAIN__() {
    'use strict';

	const CONST = {
		TextAllLang: {
			DEFAULT: 'en',
			'en': {
                ShowCards: '𝑺𝒉𝒐𝒘 𝒑𝒂𝒔𝒔𝒘𝒐𝒓𝒅 𝒄𝒂𝒓𝒅𝒔',
                RefreshTip: 'Note: If password is incorrect, '
            }
		}
	};

	// Init language
	const i18n = Object.keys(CONST.TextAllLang).includes(navigator.language) ? navigator.language : CONST.TextAllLang.DEFAULT;
	CONST.Text = CONST.TextAllLang[i18n];

    GM_registerMenuCommand(CONST.Text.ShowCards, fetchTeaser);
    async function fetchTeaser() {
        const html = await (await fetch(location.href)).text();
        const parser = new DOMParser();
        const oDom = parser.parseFromString(html, 'text/html');

        try {
            const script = Array.from(oDom.scripts).find(s => s.innerHTML.trim().startsWith('var ytInitialData'));
            const code = script.innerHTML;
            const json = code.trim().replace(/^\s*var ytInitialData *= */, '').replace(/[;\s]*$/, '');
            const data = JSON.parse(json);
            const card_texts = data.cards.cardCollectionRenderer.cards.map(card => card.cardRenderer.teaser.simpleCardTeaserRenderer.message.simpleText);
            console.log('%cCards\' contents are:%c\n%s', 'color: orange;', '', card_texts.join('\n'));
            alert('☆𝑪𝒂𝒓𝒅𝒔\' 𝒄𝒐𝒏𝒕𝒆𝒏𝒕𝒔 𝒂𝒓𝒆☆:\n' + card_texts.join('\n') + '\n ');
        } catch {
            alert("𝑪𝒐𝒖𝒍𝒅 𝒏𝒐𝒕 𝒇𝒊𝒏𝒅 𝒄𝒂𝒓𝒅𝒔 𝒊𝒏 𝒕𝒉𝒊𝒔 𝒗𝒊𝒅𝒆𝒐.\n𝑴𝒂𝒌𝒆 𝒔𝒖𝒓𝒆 𝒊𝒕'𝒔 𝑹𝑯𝒀𝑻𝑯𝑴 𝑷𝒍𝒂𝒚'𝒔 𝒗𝒊𝒅𝒆𝒐 𝒂𝒏𝒅 𝒉𝒂𝒔 𝒂 𝒑𝒂𝒔𝒔𝒘𝒐𝒓𝒅 𝒔𝒉𝒐𝒘𝒏 𝒃𝒚 𝒄𝒂𝒓𝒅𝒔.");
        }
    }

    function decorateText(text) {
        // Bonus award for those who'd love reading source codes! ww
        const common_letters = 'a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'.split(' ');
        const italic_letters = '𝒂 𝒃 𝒄 𝒅 𝒆 𝒇 𝒈 𝒉 𝒊 𝒋 𝒌 𝒍 𝒎 𝒏 𝒐 𝒑 𝒒 𝒓 𝒔 𝒕 𝒖 𝒗 𝒘 𝒙 𝒚 𝒛 𝑨 𝑩 𝑪 𝑫 𝑬 𝑭 𝑮 𝑯 𝑰 𝑱 𝑲 𝑳 𝑴 𝑵 𝑶 𝑷 𝑸 𝑹 𝑺 𝑻 𝑼 𝑽 𝑾 𝑿 𝒀 𝒁'.split(' ');
        return Array.from(text).map(char => common_letters.includes(char) ? italic_letters.at(common_letters.indexOf(char)) : char).join('');
    }
})();