Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscript to bypass the badly implemented paywall on nytimes.com. Use the “raw” links to install.
// ==UserScript==
// @name Bypass New York Times paywall (20 article limit)
// @author Mathias Bynens <http://mathiasbynens.be/>
// @link http://mths.be/axa
// @match http://www.nytimes.com/*
// ==/UserScript==
(function(d) {
d.getElementById('overlay').style.display = 'none';
d.getElementById('gatewayCreative').style.display = 'none';
d.body.style.overflow = 'scroll';
}(document));
// ==UserScript==
// @name Bypass New York Times paywall (20 article limit)
// @author Mathias Bynens <http://mathiasbynens.be/>
// @link http://mths.be/axa
// @match http://www.nytimes.com/*
// ==/UserScript==
(function(d) {
[].forEach.call(d.querySelectorAll('#overlay, #gatewayCreative'), function(e) {
e.style.display = 'none';
});
d.body.style.overflow = 'scroll';
}(document));
@unblocktheplanet

This comment has been minimized.

Copy link

@unblocktheplanet unblocktheplanet commented Mar 24, 2011

I use Mac OS X and tried to enter these options in Terminal. Don’t work!

Will some kind techie tell us Mac users how to accomplish this code.

Thanks in advance!

@mathiasbynens

This comment has been minimized.

Copy link
Owner Author

@mathiasbynens mathiasbynens commented Mar 28, 2011

@unblocktheplanet This is JavaScript, so you would have to open up Web Inspector in Safari, go to Console, paste the above snippet in there and hit Return. If you’re using Opera or Chrome, you can just click either one of the “Raw” links above to install the userscript. For Firefox, you would have to install Greasemonkey first.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Mar 28, 2011

@mathiasbynens Nice! If you want, you can make the second option even smaller:

(function(d) {
  [].forEach.call(d.querySelectorAll('#overlay, #gatewayCreative'), function(e) {
    e.style.display = 'none';
  });
  d.body.style.overflow = 'scroll';
}(document));
@mathiasbynens

This comment has been minimized.

Copy link
Owner Author

@mathiasbynens mathiasbynens commented Mar 28, 2011

@kitgoncharov Thanks for the suggestion! (I should have thought of that.)

@cscott

This comment has been minimized.

Copy link

@cscott cscott commented Mar 30, 2011

According to http://wesbos.com/remove-new-york-times-paywall-css/ they've changed the div from #gatewayCreative to #gatewayUnit.

@jasonkhanlar

This comment has been minimized.

Copy link

@jasonkhanlar jasonkhanlar commented Apr 20, 2018

Here's a work-around hack that works with Tampermonkey

// ==UserScript==
// @name         Bypass New York Times paywall (20 article limit)
// @author       Jason Khanlar <jason.khanlar@gmail.com>
// @link         http://mths.be/axa
// @match        http://www.nytimes.com/*
// @match        https://www.nytimes.com/*
// @grant        GM_webRequest
// @webRequest   [{"selector":"https://www.nytimes.com/*","action":"cancel"}]
// @run-at       document-start
// ==/UserScript==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment