自动跳过YouTube广告,移除广告横幅,绕过年龄限制并隐藏广告拦截提示。无需广告拦截器。
当前为
// ==UserScript==
// @name YouTube Freedom – Skip Ads & Bypass Age & Anti-Adblock
// @name:fr YouTube Freedom – Saute les pubs & contourne le bloquer d'âge & anti-adblock
// @name:es YouTube Freedom – Salta los anuncios & elude la restricción de edad & anti-adblock
// @name:de YouTube Freedom – Überspringe Werbung & Umgehe Altersbeschränkung & Anti-Adblock
// @name:it YouTube Freedom – Salta gli annunci & bypass restrizione età & anti-adblock
// @name:pt-BR YouTube Freedom – Pule os anúncios & contorne a restrição de idade & anti-adblock
// @name:ru YouTube Freedom – Пропусти рекламу & обойди возрастное ограничение & анти-Adblock
// @name:ar YouTube Freedom – تخطى الإعلانات & تجاوز قيود العمر & مضاد Anti-Adblock
// @name:ja YouTube Freedom – 広告をスキップ & 年齢制限を回避 & アンチAdblock
// @name:zh-CN YouTube Freedom – 跳过广告 & 绕过年龄限制 & 反Adblock
// @namespace https://github.com/youssbehh
// @version 1.0.5
// @description Automatically skips YouTube ads, removes banners, bypasses age restrictions and hides anti-adblock popup. No adblocker required.
// @description:fr Saute automatiquement les pubs YouTube, supprime les bannières, contourne les restrictions d'âge et cache l'avertissement anti-adblock. Aucun bloqueur requis.
// @description:es Omite automáticamente anuncios de YouTube, elimina banners, evita restricciones de edad y oculta advertencia anti-adblock. No requiere bloqueador.
// @description:de Überspringt automatisch YouTube-Werbung, entfernt Banner, umgeht Altersbeschränkungen und versteckt Anti-Adblock-Hinweis. Kein Blocker nötig.
// @description:it Salta automaticamente gli annunci YouTube, rimuove i banner, bypassa le restrizioni di età e nasconde l'avviso anti-adblock. Nessun adblocker richiesto.
// @description:pt-BR Pula anúncios do YouTube, remove banners, contorna restrições de idade e oculta aviso anti-adblock. Sem bloqueador externo necessário.
// @description:ru Автоматически пропускает рекламу, удаляет баннеры, обходит возрастные ограничения и скрывает предупреждение. Блокировщик не нужен.
// @description:ar يتخطى إعلانات YouTube، يزيل اللافتات، يتجاوز قيود العمر ويخفي تحذير مانع الإعلانات. لا يحتاج إلى مانع خارجي.
// @description:ja YouTube広告を自動スキップし、バナーを削除、年齢制限を回避し、広告ブロック警告を非表示にします。外部ブロッカー不要。
// @description:zh-CN 自动跳过YouTube广告,移除广告横幅,绕过年龄限制并隐藏广告拦截提示。无需广告拦截器。
// @author YoussBehh
// @icon https://cdn-icons-png.flaticon.com/64/2504/2504965.png
// @match https://www.youtube.com/*
// @match https://m.youtube.com/*
// @grant none
// @license MIT
// @noframes
// @homepage https://github.com/youssbehh/youtube-freedom
// ==/UserScript==
(function() {
'use strict';
// --- Supprimer le popup anti-adblock ---
function removeAntiAdblockPopup() {
const dialogs = document.querySelectorAll('tp-yt-paper-dialog');
dialogs.forEach(dlg => {
// Cherche des boutons/lien typiques du popup anti-adblock
const hasAdblockKeywords = dlg.querySelector('a[href*="support.google.com"]')
|| dlg.innerHTML.match(/allow\s*ads|adblock/i);
if (hasAdblockKeywords) {
dlg.remove();
const overlay = document.querySelector('tp-yt-iron-overlay-backdrop');
if (overlay) {
console.log("[Userscript] Overlay tp-yt-iron-overlay-backdrop détecté → suppression.");
overlay.remove();
}
// Restaurer l'interaction et le défilement
document.body.style.overflow = "auto";
document.documentElement.style.overflow = "auto";
document.body.style.pointerEvents = "auto";
}
});
}
// --- Bypass restriction d'âge ---
function bypassAgeRestriction() {
const ageDialog = document.querySelector('ytd-enforcement-message-view-model');
const player = document.querySelector('video');
if (ageDialog) {
ageDialog.remove();
}
// Redirection uniquement si la vidéo est bloquée par YouTube
if (player && player.paused && player.readyState === 0) {
const isAgeBlocked = !!document.querySelector('ytd-player .ytd-watch-flexy[ad-blocked]');
const videoId = new URLSearchParams(window.location.search).get("v");
if (isAgeBlocked && videoId) {
window.location.href = `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=1`;
}
}
}
// --- Skip pubs YouTube ---
function skipAds() {
const adVideo = document.querySelector('.ad-showing video, ytd-pip-container video, ytd-miniplayer-player-container video');
if (adVideo && adVideo.duration) {
adVideo.currentTime = adVideo.duration;
adVideo.muted = true;
}
const skipBtn = document.querySelector('.ytp-ad-skip-button, .ytp-ad-skip-button-modern');
if (skipBtn) {
skipBtn.click();
}
}
// --- Supprimer bannières publicitaires ---
function removeAdBanners() {
const selectors = [
'#player-ads', '#masthead-ad', '.ytp-ad-overlay-container',
'.ytp-ad-image-overlay', '.yt-mealbar-promo-renderer',
'.ytp-featured-product', 'ytd-merch-shelf-renderer'
];
selectors.forEach(sel => {
document.querySelectorAll(sel).forEach(el => el.remove());
});
}
// --- Relance la vidéo après le blocage ---
function keepVideoPlayingEarly() {
const video = document.querySelector('video');
if (!video || video.dataset.keepPlayingEarly) return;
video.dataset.keepPlayingEarly = "true"; // marque pour ne pas répéter
const onPause = () => {
if (video.currentTime <= 5) { // seulement si c'est dans les 5 premières secondes
video.play().then(() => {
}).catch(err => {
console.warn("[Userscript] Impossible de play :", err);
});
}
video.removeEventListener('pause', onPause); // une seule fois
};
video.addEventListener('pause', onPause);
}
let debounceTimeout;
const observer = new MutationObserver(() => {
clearTimeout(debounceTimeout);
debounceTimeout = setTimeout(() => {
removeAntiAdblockPopup();
bypassAgeRestriction();
skipAds();
removeAdBanners();
keepVideoPlayingEarly();
}, 100);
});
observer.observe(document.body, { childList: true, subtree: true });
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址