Skip to content

Instantly share code, notes, and snippets.

@danielwanja
Created April 4, 2011 23:02
Show Gist options
  • Save danielwanja/902658 to your computer and use it in GitHub Desktop.
Save danielwanja/902658 to your computer and use it in GitHub Desktop.
Bookmarklet to bypass NYT paywall
// From: http://toys.euri.ca/nyt.js
//Here's the old stuff:
$('overlay').hide();
$('gatewayCreative').hide();
$(document.body).setStyle( { overflow:'scroll' } );
try {
//Get the first graph:
var url = window.location.href;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
var notice = $('notice');
//alert(transport);
fulltext = transport.responseText;
//And here's my dirty secret, I don't know how to manipulate the DOM with prototype.js
var pattern=/\/NYT_CORRECTION_TOP>\n <p>\n(.*)<\/p>/gi;
text = pattern.exec(fulltext)
firstgraph = text[1];
}
});
} catch (e) {
firstgraph= "[NYTClean note, I'm looking into getting this paragraph back.]";
}
text2 = $('article').getElementsByClassName('articleBody')[0];
if(text2.innerHTML.indexOf("20 free articles")>0) {
text2.innerHTML = firstgraph;
}
@Erisfiregamer1
Copy link

Does this still work or did it get patched out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment