コトバノウタカタ

よしなしごとをつらつらとつづるばしょ。

YouTubeのショートやクリップの動画を開く 修正

javascript: (function () {
    var code = "";
    var mt = /https:\/\/www\.youtube\.com\/shorts\/(.+)/i.exec(location.href);
    if (mt != null) {
        code = mt[1];
    }
    else{
        var m = document.querySelector("meta[itemprop='videoId'], meta[itemprop='identifier']");
        if (m != null) {
            code = m.getAttribute("content");
        }
    }
    if (code != "") {
        var url = "https://www.youtube.com/watch?v=" + code;
        location.href = url;
    }
    else {
        alert("Invalid page!");
    }
    return;
}
)();

セレクタにマッチするタグの内容を取得する

セレクタで指定したタグすべての内容を取得するブックマークレット。ChatGPTで一瞬でできたまじ便利。

javascript:(function() {
    var selector = prompt('セレクタを入力してください');

    if (selector) {
        var elements = document.querySelectorAll(selector);
        if (elements.length > 0) {
            var textToCopy = Array.from(elements).map(function(element) {
                return element.textContent;
            }).join('\n');
            
            var textArea = document.createElement('textarea');
            textArea.value = textToCopy;
            document.body.appendChild(textArea);
            textArea.select();
            document.execCommand('copy');
            document.body.removeChild(textArea);
            
            alert('コピーしました:\n' + textToCopy);
        } else {
            alert('セレクタに一致する要素が見つかりませんでした');
        }
    }
})();

2024年冬アニメ

異修羅

青の祓魔師 -島根啓明結社篇-(第3期)

真の仲間じゃないと勇者のパーティーを追い出されたので、辺境でスローライフすることにしました 第2期

魔女と野獣

メタリックルージュ

続きを読む

2023秋アニメ

魔法使いの嫁 SEASON2【第2クール】

盾の勇者の成り上がり Season3

ゴブリンスレイヤー

はめつのおうこく

最果てのパラディン -鉄錆の山の王-(第2期)

続きを読む

Twitterの画像一覧

なんか標準がwebpになってたので、jpegに変換するように。表示してる前後のものしか出ません。

javascript: (function () { var v, w = window, d = 'document', h = w[d].title, x = [], t = 'IMG', s, r, e, j = -1, m, n; function f(w) { var i = 0; while (v = w.frames[i++]) try { f(v) } catch (v) { } i = 0, e = w[d].getElementsByTagName(t); while (v = e[i++]) if ((r = j == 6 && /^(src)$/i.test(v.name) ? v.value : v.src) && !/script:/.test(r)) { if (r.substr(8, 19) == %27pbs.twimg.com/media%27) { n = r.lastIndexOf(%27&name=%27); if (n > 5) { r = r.substr(0, n) } r += "&name=4096x4096"; r = r.replace(/webp/g, 'jpg'); if (!x[r]) x[r] = 1, s += (%27<a href=%27 + r + %27 target="_blank"><img src=%27 + r + %27 height=150></a>%27).link(r) } } } { s = %27%27; f(w); if (s) h += %27<h3>&lt;%27 + t + %27 &gt;</h3 > %27 + s } with (w.open()[d]) open(), write(h), close() } )()

YouTubeのショートやクリップを普通のページにするやつ

YouTubeのショートを普通のページにするやつ

javascript: (function () {
    var m = $("meta[itemprop='videoId']");
    if (m.length > 0) {
        location.href = "https://www.youtube.com/watch?v=" + m.attr("content");
        return;
    }
    else {
        var mt = /https:\/\/www\.youtube\.com\/shorts\/(.+)/i.exec(location.href);
        if (mt != null) {
            location.href = "https://www.youtube.com/watch?v=" + mt[1];
            return;
        }
    }
    alert("Invalid page!");
    return;
}
)()

クリップにも対応。

javascript: (
    function () {
        var code = "";
        var m = $("meta[itemprop='videoId'], meta[itemprop='identifier']");
        if (m.length > 0) {
            code = m.attr("content");
        }
        if (code == "") {
            var mt = /https:\/\/www\.youtube\.com\/shorts\/(.+)/i.exec(location.href);
            if (mt != null) {
                code = mt[1];
            }
        }

        if (code != "") {
            var url = "https://www.youtube.com/watch?v=" + code;
            location.href = url;
        }
        else {
            alert("Invalid page!");
        }
        return;
    }

)()


クリップの方は右クリックで「動画のURLをコピー」すればいいんですけどね。

2023年夏アニメ

続きを読む