🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

YouTube - Filtrar videos "Members only" (Ocultar o Marcar)

🇲🇽 Filtra videos "Solo para miembros" en YouTube: puedes ocultarlos o marcarlos visualmente según prefieras.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         YouTube - Filtrar videos "Members only" (Ocultar o Marcar)
// @namespace    https://greasyfork.org/users/TuUsuario
// @version      1.0
// @description  🇲🇽 Filtra videos "Solo para miembros" en YouTube: puedes ocultarlos o marcarlos visualmente según prefieras.
// @author       TuNombre
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    /**
     * 🇲🇽 OPCIÓN DE MODO:
     * Cambia el valor de 'mode' a "hide" (ocultar) o "highlight" (marcar visualmente)
     * Por defecto está en "hide" para ocultar los videos.
     *
     * 🇺🇸 MODE OPTION:
     * Change the value of 'mode' to "hide" or "highlight"
     * Default is "hide" to completely hide the videos.
     */
    const mode = "hide"; // Opciones válidas: "hide" o "highlight"

    function filterMembersOnlyVideos() {
        const videos = document.querySelectorAll('ytd-grid-video-renderer, ytd-rich-item-renderer, ytd-video-renderer');

        videos.forEach(video => {
            const alreadyHandled = video.getAttribute("data-members-handled");

            if (!alreadyHandled && (video.innerText.includes("Members only") || video.innerText.includes("Solo para miembros"))) {
                if (mode === "hide") {
                    video.style.display = "none";
                } else if (mode === "highlight") {
                    video.style.boxSizing = "border-box";
                    video.style.border = "2px solid crimson";
                    video.style.filter = "grayscale(70%) opacity(75%)";
                    video.style.backgroundColor = "#fff0f0";
                }
                video.setAttribute("data-members-handled", "true");
            }
        });
    }

    const observer = new MutationObserver(() => {
        filterMembersOnlyVideos();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    window.addEventListener('load', filterMembersOnlyVideos);
})();