Skip to content

for Auto-Skip-YouTube-Ads #16

@senatov

Description

@senatov

My working suggestion to Script Auto-Skip-YouTube-Ads

/**

  • CSS selectors for ad elements to hide.

  • Carefully curated to avoid hiding legitimate UI elements.
    */
    const adsSelectors = [
    // ========== PLAYER ADS ==========

      // Ad banner in the upper right corner, above the video playlist.
      '#player-ads',
      // Masthead ad on home page.
      '#masthead-ad',
    
      // Mealbar promo renderer (Premium promotions).
      '.yt-mealbar-promo-renderer',
      'ytd-mealbar-promo-renderer',
    
      // Featured product ad banner at the bottom left of the video.
      '.ytp-featured-product',
    
      // Products shelf ad banner below the video description.
      'ytd-merch-shelf-renderer',
    
      // YouTube Music Premium trial promotion dialog.
      'ytmusic-mealbar-promo-renderer',
    
      // ========== VIDEO AD INDICATORS ==========
    
      // Yellow ad progress bar segments.
      '.ytp-ad-progress',
      '.ytp-ad-progress-list',
    
      // Ad duration remaining indicator.
      '.ytp-ad-duration-remaining',
    
      // Ad simple card content.
      '.ytp-ad-simple-ad-badge',
    
      // Ad hover state indicator.
      '.ytp-ad-hover',
    
      // ========== HOMEPAGE & FEED ADS ==========
    
      // Generic ad slot renderer (main feed ads).
      'ytd-ad-slot-renderer',
    
      // In-feed ad layout.
      'ytd-in-feed-ad-layout-renderer',
    
      // Banner promo on homepage.
      'ytd-banner-promo-renderer',
    
      // Video masthead ad (large banner at top).
      'ytd-video-masthead-ad-v3-renderer',
    
      // Primetime channel promo.
      'ytd-primetime-promo-renderer',
    
      // Statement banner (subscription promos).
      'ytd-statement-banner-renderer',
    
      // Brand video shelf.
      'ytd-brand-video-singleton-renderer',
      'ytd-brand-video-shelf-renderer',
    
      // Display ad renderer.
      'ytd-display-ad-renderer',
    
       // ========== PRODUCT & MERCH ADS ==========
    
      // Paid content overlay (sponsored indicator).
      '.ytp-paid-content-overlay',
      '.ytp-paid-content-overlay-text',
    
      // Product details and cards.
      'ytd-product-details-endpoint-renderer',
      'ytd-compact-product-renderer',
    
      // ========== PREMIUM & SUBSCRIPTION PROMOS ==========
    
      // Enforcement message (ad blocker warnings).
      'ytd-enforcement-message-view-model',
    
      // ========== YOUTUBE SHORTS ADS ==========
    
      // Shorts ad indicators.
      'ytd-reel-video-renderer[is-ad]',
      'ytd-ad-slot-renderer[data-style="SHORTS"]',
    
      // ========== YOUTUBE MUSIC SPECIFIC ==========
    
      // Music promoted items.
      'ytmusic-promoted-item-renderer',
    
      // ========== ATTRIBUTE-BASED SELECTORS ==========
    
      // Elements with ad slot data.
      '[data-ad-slot]',
    
      // Rich section promo (Shorts shelf promo).
      'ytd-rich-section-renderer[is-shorts-shelf-promo]',
    
      // ========== MOBILE & APP PROMOS ==========
    
      // Mobile app notification.
      '.ytp-mobile-app-notification',
    
      // Autonav bar (mobile).
      '.ytm-autonav-bar',
    
      // ========== MISC AD ELEMENTS ==========
    
      // Survey and feedback prompts in player.
      '.ytp-ad-survey',
    
      // Companion ad slots.
      '.ytp-ad-companion-slot',
    
      // Shopping companion overlay.
      '.ytp-shopping-companion-overlay'
    

    ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions