您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Simply hides all videos that were produced by livestreams and livestreams themselves from your subscriptions feed.
// ==UserScript== // @name Youtube - Hide Livestreams in Subscriptions // @description Simply hides all videos that were produced by livestreams and livestreams themselves from your subscriptions feed. // @namespace azzurite.tv // @match https://www.youtube.com/* // @grant none // @version 1.0 // @author Azzurite // @license GPLv3 // ==/UserScript== function hasLiveTag(card) { return [...card.querySelectorAll(`p`)].some(elem => elem.textContent === `LIVE`); } function hasStreamedMetadata(card) { return card.querySelector(`#metadata-line`)?.textContent.includes(`Streamed`); } function isFromLivestream(card) { return hasLiveTag(card) || hasStreamedMetadata(card); } function fixLayoutAfterRemoving(feed) { debugger; (function shiftUp() { const items = [...feed.children]; const shortsIdx = items.findLastIndex(item => item.querySelector(`h2`)?.textContent.includes(`Shorts`)) const shorts = items[shortsIdx]; const shiftUpToIdx = feed.classList.contains(`ytd-rich-grid-renderer`) ? 7 : 1; let toShiftUp = shiftUpToIdx - shortsIdx; let i = shortsIdx + 1; for (let i = shortsIdx + 1; toShiftUp !== 0; ++i, --toShiftUp) { feed.insertBefore(items[i], shorts); } })(); (function fixFirstOfColumn() { const items = [...feed.querySelectorAll(`:scope > ytd-rich-item-renderer`)]; for (let i = 0; i !== items.length; ++i) { const item = items[i]; if (i % 3 === 0) { if (!item.hasAttribute(`is-in-first-column`)) item.setAttribute(`is-in-first-column`); } else { item.removeAttribute(`is-in-first-column`); } } })(); } setInterval(() => { if (location.href !== `https://www.youtube.com/feed/subscriptions`) { return; } const feed = document.querySelector(`[page-subtype="subscriptions"] > #primary > ytd-rich-grid-renderer > #contents`); if (!feed) { return; } const items = [...feed.querySelectorAll(`:scope > ytd-rich-item-renderer`)]; for (let i = 0; i < items.length; ++i) { const cur = items[i]; if (isFromLivestream(cur)) { cur.remove(); } } fixLayoutAfterRemoving(feed); }, 500);