Last active
December 11, 2024 02:49
-
-
Save taowen/2a49387d5abc195ba57acbb94f4dd28f to your computer and use it in GitHub Desktop.
extract text from https://youtube.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name youtube转文本到剪贴板 | |
// @description 方便粘贴到 chatgpt 进行问答 | |
// @namespace github.com/taowen | |
// @match https://www.youtube.com/* | |
// @version 1.0.0 | |
// @author taowen | |
// @license MIT | |
// @grant GM.registerMenuCommand | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
GM.registerMenuCommand("复制转录文稿到剪贴板", () => { | |
const segments = []; | |
for(const elem of document.getElementsByClassName('segment-text')) { | |
segments.push(elem.textContent); | |
} | |
const text = segments.join(' '); | |
GM_setClipboard (text); | |
alert('copied ' + text.length + ' characters'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment