deuxdoom

Remove YouTube Sponsored Label Overlay

Apr 11th, 2025 (edited)
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.65 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name         Remove YouTube Sponsored Label (CSS)
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2.0
  5. // @description  유료 광고 포함 라벨을 CSS로 숨겨 오클릭 방지. Hides YouTube "includes promotion" overlays via CSS.
  6. // @author       SAKURA
  7. // @match        https://www.youtube.com/*
  8. // @grant        GM_addStyle
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     const selectors = [
  15.         // 데스크탑: 영상 정보란의 텍스트 라벨 링크
  16.         'ytd-video-primary-info-renderer a.yt-simple-endpoint[href*="https://support.google.com/youtube?p=ppp"]',
  17.         // 데스크탑: 영상 재생 시 나타나는 오버레이
  18.         '#paid-content-overlay',
  19.         'ytd-paid-content-overlay-renderer',
  20.         // 모바일: 영상 재생 시 나타나는 오버레이
  21.         '.ytm-paid-content-overlay-renderer',
  22.         '.YtmPaidContentOverlayHost',
  23.         // 접근성 라벨을 이용한 포괄적 타겟팅
  24.         '[aria-label*="유료 프로모션 포함"]',
  25.         '[aria-label*="Includes paid promotion"]'
  26.     ];
  27.  
  28.     const css = `
  29.         ${selectors.join(',\n')} {
  30.             display: none !important;
  31.         }
  32.     `;
  33.  
  34.     // GM_addStyle는 대부분의 유저스크립트 관리자에서 지원하는 안전한 API입니다.
  35.     if (typeof GM_addStyle === 'function') {
  36.         GM_addStyle(css);
  37.     } else {
  38.         // 지원되지 않을 경우 수동으로 style 태그 삽입
  39.         const styleNode = document.createElement('style');
  40.         styleNode.textContent = css;
  41.         (document.head || document.documentElement).appendChild(styleNode);
  42.     }
  43. })();
Advertisement
Add Comment
Please, Sign In to add comment