有没有扩展将youtube字幕大写改成小写的

阅读:1080回复:7
2024-01-17 09:41
写私信
楼主#
那些每个字母都大写的英文字幕看起来眼花费劲
My Technical Blog: http://art-technical.blogspot.com/
2024-01-17 09:50
写私信
1楼#
没遇到过全是大写字母的字幕,给个链接看看。
2024-01-17 09:52
写私信
2楼#
My Technical Blog: http://art-technical.blogspot.com/
2024-01-18 15:17
写私信
3楼#
随便写的猴子脚本,youtube的页面代码时不时改,不保证能用多久
(function obs() {
  let c = document.querySelector("#ytp-caption-window-container");
  if (c == null) {
    setTimeout(obs, 100);
    return;
  }
  new MutationObserver(function(mutationList, observer) {
    for (const mutation of mutationList) {
      for (const node of mutation.addedNodes) {
        let s = node.querySelector(".ytp-caption-segment");
        if (s !== null) {
          s.innerText = s.innerText.toLowerCase();
        }
      }
    }
  }).observe(c, { childList: true });
})()
2024-01-18 20:44
写私信
4楼#
taoww:随便写的猴子脚本,youtube的页面代码时不时改,不保证能用多久
(function obs() {
  let c = document.querySelector("#ytp-caption-window-container");...
回到原帖
大佬,没效果呢
// ==UserScript==
// @name         youtubeSmallLowerCase
// @namespace    http://tampermonkey.net/
// @version      2024-01-18
// @description  try to take over the world!
// @author       You
// @match        *://*.youtube.*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=firefox.net.cn
// @grant        none
// ==/UserScript==
  
(function obs() {
  let c = document.querySelector("#ytp-caption-window-container");
  if (c == null) {
    setTimeout(obs, 100);
    return;
  }
  new MutationObserver(function(mutationList, observer) {
    for (const mutation of mutationList) {
      for (const node of mutation.addedNodes) {
        let s = node.querySelector(".ytp-caption-segment");
        if (s !== null) {
          s.innerText = s.innerText.toLowerCase();
        }
      }
    }
  }).observe(c, { childList: true });
})();
My Technical Blog: http://art-technical.blogspot.com/
2024-01-19 16:34
写私信
5楼#
viewtheard:大佬,没效果呢
// ==UserScript==
// @name         youtubeSmallLowerCase
// @namespace    http://tampermonkey.net/
// @versi...
回到原帖
你把匹配目标写成*://*.youtube.*,根本不会生效啊。你在youtube上点tampermonkey的图标应该会告诉你脚本根本没有启用
后面的代码也稍微改了下,支持那种逐字出现的动态听译字幕了
// ==UserScript==
// @name         youtubeSmallLowerCase
// @namespace    http://tampermonkey.net/
// @version      2024-01-18
// @description  try to take over the world!
// @author       You
// @match        *://*.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=firefox.net.cn
// @grant        none
// ==/UserScript==
      
(function obs() {
  let c = document.querySelector("#ytp-caption-window-container");
  if (c == null) {
    setTimeout(obs, 100);
    return;
  }
  new MutationObserver(function(mutationList, observer) {
    for (const mutation of mutationList) {
      for (const node of mutation.addedNodes) {
        if (node.nodeType === 3) {
          node.textContent = node.textContent.toLowerCase();
        }
      }
    }
  }).observe(c, { childList: true, subtree: true });
})();
2024-01-20 06:17
写私信
6楼#
taoww:你把匹配目标写成*://*.youtube.*,根本不会生效啊。你在youtube上点tampermonkey的图标应该会告诉你脚本根本没有启用
后面的代码也稍微改了下,支持那种逐字出现的动态听译字幕了
// ==UserScript=...
回到原帖
厉害,可以了,建议如果可以再加个条件判断下如果是全大写字幕再强制转换(如整段字幕第一句开头第二个单词为大写),因为有些是姓名,地名,缩写的大小写正常句子不需要转换
My Technical Blog: http://art-technical.blogspot.com/
2024-02-22 11:46
写私信
7楼#
@-moz-document domain("www.youtube.com") {
    .captions-text {text-transform: lowercase !important;}
}
css即可实现,很奇怪的是,改为capitalize,是没有效果的。capitalize的效果是每个单词首字母大写,其他小写。