YouTube Ad Blocker Pro - غير قابل للكشف

حاجب إعلانات يوتيوب متقدم وغير قابل للاكتشاف - يحجب جميع أنواع الإعلانات بذكاء

Size

11.9 KB

Version

1.0.1

Created

Dec 19, 2025

Updated

about 1 month ago

1// ==UserScript==
2// @name		YouTube Ad Blocker Pro - غير قابل للكشف
3// @description		حاجب إعلانات يوتيوب متقدم وغير قابل للاكتشاف - يحجب جميع أنواع الإعلانات بذكاء
4// @version		1.0.1
5// @match		https://*.youtube.com/*
6// @icon		https://www.youtube.com/s/desktop/ba2eeb09/img/favicon_32x32.png
7// ==/UserScript==
8(function() {
9    'use strict';
10
11    console.log('🛡️ YouTube Ad Blocker Pro - تم التفعيل');
12
13    // ============================================
14    // 1. إخفاء آثار حاجب الإعلانات
15    // ============================================
16    
17    // إخفاء خصائص الكشف عن حاجبات الإعلانات
18    function hideAdBlockerTraces() {
19        // إزالة خصائص الكشف الشائعة
20        Object.defineProperty(navigator, 'webdriver', {
21            get: () => false
22        });
23
24        // إخفاء أي علامات على وجود حاجب إعلانات
25        const originalQuery = document.querySelector.bind(document);
26        document.querySelector = function(selector) {
27            if (selector && selector.includes('adblock')) {
28                return null;
29            }
30            return originalQuery(selector);
31        };
32    }
33
34    // ============================================
35    // 2. حجب الإعلانات المرئية
36    // ============================================
37    
38    function blockVisualAds() {
39        const adSelectors = [
40            // إعلانات الفيديو
41            'ytd-display-ad-renderer',
42            'ytd-video-masthead-ad-v3-renderer',
43            'ytd-promoted-sparkles-web-renderer',
44            'ytd-ad-slot-renderer',
45            'ytd-in-feed-ad-layout-renderer',
46            'ytd-banner-promo-renderer',
47            
48            // إعلانات الشريط الجانبي
49            '#player-ads',
50            '.video-ads',
51            '.ytp-ad-module',
52            '.ytp-ad-overlay-container',
53            '.ytp-ad-text-overlay',
54            
55            // إعلانات البانر
56            'ytd-companion-slot-renderer',
57            '#masthead-ad',
58            '.ytd-merch-shelf-renderer',
59            
60            // إعلانات البحث
61            'ytd-search-pyv-renderer',
62            'ytd-promoted-video-renderer',
63            
64            // إعلانات أخرى
65            '.ytd-action-companion-ad-renderer',
66            '.ytd-statement-banner-renderer'
67        ];
68
69        adSelectors.forEach(selector => {
70            const elements = document.querySelectorAll(selector);
71            elements.forEach(el => {
72                if (el) {
73                    el.style.display = 'none';
74                    el.remove();
75                }
76            });
77        });
78    }
79
80    // ============================================
81    // 3. تخطي إعلانات الفيديو تلقائياً
82    // ============================================
83    
84    function skipVideoAds() {
85        const video = document.querySelector('video.html5-main-video');
86        
87        if (video) {
88            // التحقق من وجود إعلان
89            const adContainer = document.querySelector('.video-ads.ytp-ad-module');
90            const adPlaying = document.querySelector('.ad-showing');
91            
92            if (adContainer || adPlaying) {
93                console.log('🚫 تم اكتشاف إعلان - جاري التخطي...');
94                
95                // تسريع الإعلان إلى النهاية
96                video.playbackRate = 16;
97                video.currentTime = video.duration;
98                
99                // النقر على زر التخطي إذا كان متاحاً
100                setTimeout(() => {
101                    const skipButton = document.querySelector('.ytp-ad-skip-button, .ytp-skip-ad-button, button.ytp-ad-skip-button-modern');
102                    if (skipButton) {
103                        skipButton.click();
104                        console.log('✅ تم تخطي الإعلان');
105                    }
106                }, 100);
107                
108                // إعادة السرعة الطبيعية
109                setTimeout(() => {
110                    video.playbackRate = 1;
111                }, 500);
112            }
113        }
114    }
115
116    // ============================================
117    // 4. حجب طلبات الإعلانات
118    // ============================================
119    
120    function blockAdRequests() {
121        // قائمة نطاقات الإعلانات
122        const adDomains = [
123            'doubleclick.net',
124            'googlesyndication.com',
125            'googleadservices.com',
126            'google-analytics.com',
127            'googletagmanager.com',
128            'youtube.com/api/stats/ads',
129            'youtube.com/pagead/',
130            'youtube.com/ptracking',
131            'youtube.com/api/stats/qoe'
132        ];
133
134        // اعتراض طلبات الشبكة
135        const originalFetch = window.fetch;
136        window.fetch = function(...args) {
137            const url = args[0];
138            if (typeof url === 'string') {
139                for (const domain of adDomains) {
140                    if (url.includes(domain)) {
141                        console.log('🚫 تم حجب طلب إعلان:', url);
142                        return Promise.reject(new Error('Ad blocked'));
143                    }
144                }
145            }
146            return originalFetch.apply(this, args);
147        };
148
149        // اعتراض XMLHttpRequest
150        const originalOpen = XMLHttpRequest.prototype.open;
151        XMLHttpRequest.prototype.open = function(method, url) {
152            if (typeof url === 'string') {
153                for (const domain of adDomains) {
154                    if (url.includes(domain)) {
155                        console.log('🚫 تم حجب طلب XHR:', url);
156                        return;
157                    }
158                }
159            }
160            return originalOpen.apply(this, arguments);
161        };
162    }
163
164    // ============================================
165    // 5. إزالة رسائل كشف حاجب الإعلانات
166    // ============================================
167    
168    function removeAdBlockerWarnings() {
169        const warningSelectors = [
170            'ytd-enforcement-message-view-model',
171            'tp-yt-paper-dialog[aria-label*="ad"]',
172            'ytd-popup-container',
173            '[class*="adblock"]',
174            '[id*="adblock"]'
175        ];
176
177        warningSelectors.forEach(selector => {
178            const elements = document.querySelectorAll(selector);
179            elements.forEach(el => {
180                const text = el.textContent.toLowerCase();
181                if (text.includes('ad blocker') || text.includes('adblock') || 
182                    text.includes('حاجب الإعلانات') || text.includes('إعلانات')) {
183                    el.remove();
184                    console.log('✅ تم إزالة رسالة تحذير');
185                }
186            });
187        });
188    }
189
190    // ============================================
191    // 6. إخفاء أزرار الإعلانات المدفوعة
192    // ============================================
193    
194    function hideSponsoredContent() {
195        // إخفاء المحتوى المدفوع والمروج
196        const sponsoredElements = document.querySelectorAll('[aria-label*="Sponsored"], [aria-label*="مُروَّج"], ytd-compact-promoted-item-renderer');
197        sponsoredElements.forEach(el => {
198            const parent = el.closest('ytd-video-renderer, ytd-compact-video-renderer, ytd-grid-video-renderer');
199            if (parent) {
200                parent.style.display = 'none';
201            }
202        });
203    }
204
205    // ============================================
206    // 7. منع تشغيل الإعلانات من البداية
207    // ============================================
208    
209    function preventAdPlayback() {
210        const video = document.querySelector('video.html5-main-video');
211        if (video) {
212            // مراقبة تغييرات الفيديو
213            video.addEventListener('loadedmetadata', function() {
214                const adIndicator = document.querySelector('.ytp-ad-player-overlay, .video-ads');
215                if (adIndicator) {
216                    console.log('🚫 منع تشغيل إعلان');
217                    video.currentTime = video.duration;
218                }
219            });
220        }
221    }
222
223    // ============================================
224    // 8. إضافة أنماط CSS لإخفاء الإعلانات
225    // ============================================
226    
227    function injectAdBlockingStyles() {
228        const style = document.createElement('style');
229        style.textContent = `
230            /* إخفاء جميع أنواع الإعلانات */
231            ytd-display-ad-renderer,
232            ytd-promoted-sparkles-web-renderer,
233            ytd-ad-slot-renderer,
234            ytd-in-feed-ad-layout-renderer,
235            ytd-banner-promo-renderer,
236            ytd-video-masthead-ad-v3-renderer,
237            ytd-statement-banner-renderer,
238            ytd-action-companion-ad-renderer,
239            ytd-companion-slot-renderer,
240            ytd-merch-shelf-renderer,
241            ytd-promoted-video-renderer,
242            ytd-compact-promoted-item-renderer,
243            .video-ads,
244            .ytp-ad-module,
245            .ytp-ad-overlay-container,
246            .ytp-ad-text-overlay,
247            .ytp-ad-player-overlay,
248            #player-ads,
249            #masthead-ad {
250                display: none !important;
251                visibility: hidden !important;
252                height: 0 !important;
253                width: 0 !important;
254                position: absolute !important;
255                left: -9999px !important;
256            }
257            
258            /* إزالة المساحة الفارغة */
259            ytd-rich-item-renderer:has(ytd-display-ad-renderer) {
260                display: none !important;
261            }
262        `;
263        document.head.appendChild(style);
264        console.log('✅ تم إضافة أنماط حجب الإعلانات');
265    }
266
267    // ============================================
268    // 9. مراقب DOM للإعلانات الجديدة
269    // ============================================
270    
271    function setupMutationObserver() {
272        const observer = new MutationObserver((mutations) => {
273            blockVisualAds();
274            skipVideoAds();
275            removeAdBlockerWarnings();
276            hideSponsoredContent();
277        });
278
279        observer.observe(document.body, {
280            childList: true,
281            subtree: true
282        });
283
284        console.log('👁️ تم تفعيل مراقب الإعلانات');
285    }
286
287    // ============================================
288    // 10. التهيئة والتشغيل
289    // ============================================
290    
291    function init() {
292        console.log('🚀 بدء تهيئة حاجب الإعلانات...');
293        
294        // تطبيق جميع الوظائف
295        hideAdBlockerTraces();
296        injectAdBlockingStyles();
297        blockAdRequests();
298        
299        // تشغيل الوظائف الأساسية
300        const runBlockers = () => {
301            blockVisualAds();
302            skipVideoAds();
303            removeAdBlockerWarnings();
304            hideSponsoredContent();
305            preventAdPlayback();
306        };
307        
308        // تشغيل فوري
309        runBlockers();
310        
311        // تشغيل دوري كل 500 ميلي ثانية
312        setInterval(runBlockers, 500);
313        
314        // إعداد المراقب
315        if (document.body) {
316            setupMutationObserver();
317        } else {
318            document.addEventListener('DOMContentLoaded', setupMutationObserver);
319        }
320        
321        console.log('✅ تم تفعيل حاجب الإعلانات بنجاح!');
322    }
323
324    // بدء التشغيل
325    if (document.readyState === 'loading') {
326        document.addEventListener('DOMContentLoaded', init);
327    } else {
328        init();
329    }
330
331})();
YouTube Ad Blocker Pro - غير قابل للكشف | Robomonkey