YouTube Live Chat Downloader

Downloads the current live chat from YouTube for future reading. Please take note that this is in beta stage and more features are going to be added or fixed soon. Press "A" to download the live chats. Do not focus onto the chat input on the bottom before you start typing. There will be a button for this soon.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         YouTube Live Chat Downloader
// @namespace    https://youtube.com
// @version      1.1
// @description  Downloads the current live chat from YouTube for future reading. Please take note that this is in beta stage and more features are going to be added or fixed soon. Press "A" to download the live chats. Do not focus onto the chat input on the bottom before you start typing. There will be a button for this soon.
// @author       Sabrina
// @match        https://www.youtube.com/live_chat*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=YouTube.com
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @require      https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
// @grant        none
// ==/UserScript==

window.chatLogs = "";

$(".style-scope yt-live-chat-item-list-renderer").on('DOMNodeInserted', function(e) {
    if(e.target.id === "content") {
        setTimeout(() => {
            chatLogs += (e.target.outerText.replace(/[\r\n]/g, " - ")) + "<br>";
        }, 1);
    }
});

window.downloadLiveChat = function() {
    const link = document.createElement("a");
    const file = new Blob([chatLogs], { type: 'text/plain' });
    link.href = URL.createObjectURL(file);
    link.download = "ytlivechat"+new Date().getTime()+".html";
    link.click();
    URL.revokeObjectURL(link.href);
}

document.addEventListener("keydown", function(e) {
    if(e.keyCode == 65) {
        downloadLiveChat();
    }
});