The Hindu Paywall Bypasser & Ad Remover

Removes paywalls, subscription popups, and advertisements from The Hindu website

Size

5.9 KB

Version

1.0.1

Created

Oct 28, 2025

Updated

17 days ago

1// ==UserScript==
2// @name		The Hindu Paywall Bypasser & Ad Remover
3// @description		Removes paywalls, subscription popups, and advertisements from The Hindu website
4// @version		1.0.1
5// @match		https://*.thehindu.com/*
6// @icon		https://www.thehindu.com/favicon.ico
7// ==/UserScript==
8(function() {
9    'use strict';
10
11    console.log('The Hindu Paywall Bypasser & Ad Remover initialized');
12
13    // Function to remove paywall and subscription elements
14    function removePaywallElements() {
15        const paywallSelectors = [
16            '#subscriptioncontainer',
17            '.subscriptioncontainer',
18            '.paywall',
19            '.paywall-container',
20            '.subscription-banner',
21            '.prime-article-banner',
22            '[class*="paywall"]',
23            '[class*="subscription"]',
24            '[id*="paywall"]',
25            '[id*="subscription"]',
26            '.modal-backdrop',
27            '.modal[style*="display: block"]',
28            'div[class*="overlay"]',
29            'div[class*="popup"]'
30        ];
31
32        paywallSelectors.forEach(selector => {
33            const elements = document.querySelectorAll(selector);
34            elements.forEach(el => {
35                console.log('Removing paywall element:', el);
36                el.remove();
37            });
38        });
39    }
40
41    // Function to remove ads
42    function removeAds() {
43        const adSelectors = [
44            'iframe[src*="ads"]',
45            'iframe[src*="doubleclick"]',
46            'iframe[src*="googlesyndication"]',
47            'div[id*="ad"]',
48            'div[class*="ad-"]',
49            'div[class*="advertisement"]',
50            'div[class*="advert"]',
51            '[class*="google-ad"]',
52            '[id*="google_ads"]',
53            '.ad-container',
54            '.ad-wrapper',
55            '.ad-slot',
56            '.banner-ad',
57            'ins.adsbygoogle',
58            '[data-ad-slot]',
59            '[data-google-query-id]'
60        ];
61
62        adSelectors.forEach(selector => {
63            const elements = document.querySelectorAll(selector);
64            elements.forEach(el => {
65                console.log('Removing ad element:', el);
66                el.remove();
67            });
68        });
69    }
70
71    // Function to unlock article content
72    function unlockContent() {
73        // Remove blur effects
74        const blurredElements = document.querySelectorAll('[style*="blur"]');
75        blurredElements.forEach(el => {
76            el.style.filter = 'none';
77            el.style.webkitFilter = 'none';
78        });
79
80        // Remove height restrictions
81        const restrictedElements = document.querySelectorAll('[style*="max-height"], [style*="overflow: hidden"]');
82        restrictedElements.forEach(el => {
83            el.style.maxHeight = 'none';
84            el.style.overflow = 'visible';
85        });
86
87        // Enable scrolling
88        document.body.style.overflow = 'auto';
89        document.documentElement.style.overflow = 'auto';
90
91        // Remove pointer-events blocking
92        const blockedElements = document.querySelectorAll('[style*="pointer-events"]');
93        blockedElements.forEach(el => {
94            el.style.pointerEvents = 'auto';
95        });
96    }
97
98    // Add CSS to hide common paywall and ad patterns
99    const style = document.createElement('style');
100    style.textContent = `
101        /* Hide paywall elements */
102        #subscriptioncontainer,
103        .subscriptioncontainer,
104        .paywall,
105        .paywall-container,
106        .subscription-banner,
107        .prime-article-banner,
108        [class*="paywall"],
109        [id*="paywall"],
110        .modal-backdrop {
111            display: none !important;
112            visibility: hidden !important;
113            opacity: 0 !important;
114            height: 0 !important;
115            width: 0 !important;
116        }
117
118        /* Hide ads */
119        iframe[src*="ads"],
120        iframe[src*="doubleclick"],
121        iframe[src*="googlesyndication"],
122        div[id*="ad-"],
123        div[class*="ad-"],
124        div[class*="advertisement"],
125        .ad-container,
126        .ad-wrapper,
127        .ad-slot,
128        .banner-ad,
129        ins.adsbygoogle,
130        [data-ad-slot],
131        [data-google-query-id] {
132            display: none !important;
133            visibility: hidden !important;
134        }
135
136        /* Ensure content is visible */
137        body, html {
138            overflow: auto !important;
139        }
140
141        /* Remove blur effects */
142        .article-content,
143        .articlebodycontent,
144        [class*="article"] {
145            filter: none !important;
146            -webkit-filter: none !important;
147            max-height: none !important;
148            overflow: visible !important;
149        }
150    `;
151    document.head.appendChild(style);
152
153    // Debounce function to prevent excessive calls
154    function debounce(func, wait) {
155        let timeout;
156        return function executedFunction(...args) {
157            const later = () => {
158                clearTimeout(timeout);
159                func(...args);
160            };
161            clearTimeout(timeout);
162            timeout = setTimeout(later, wait);
163        };
164    }
165
166    // Main cleanup function
167    function cleanPage() {
168        removePaywallElements();
169        removeAds();
170        unlockContent();
171    }
172
173    // Run cleanup immediately
174    cleanPage();
175
176    // Run cleanup after DOM is fully loaded
177    if (document.readyState === 'loading') {
178        document.addEventListener('DOMContentLoaded', cleanPage);
179    }
180
181    // Run cleanup after page is fully loaded
182    window.addEventListener('load', cleanPage);
183
184    // Watch for dynamic content changes
185    const debouncedCleanPage = debounce(cleanPage, 1000);
186    const observer = new MutationObserver(debouncedCleanPage);
187    
188    observer.observe(document.body, {
189        childList: true,
190        subtree: true
191    });
192
193    // Periodic cleanup every 2 seconds for persistent elements
194    setInterval(cleanPage, 2000);
195
196    console.log('The Hindu Paywall Bypasser & Ad Remover is active');
197})();
The Hindu Paywall Bypasser & Ad Remover | Robomonkey