Haaretz Premium Bypass Userscript POC

Haaretz site became paywalled a couple of months ago, allowing reading 10 “premium” articles before requiring payment. After a friend recommended their app for smartphones, which unlike the site is free, I started reading it mainly on my phone. Few days ago I had no internet connection on my phone, and instead of seeing an article I saw an error page saying it’s not reachable (the usual android’s built-in browser type). The url was something like http://www.haaretz.co.il/misc/smartphone-article/.premium-1.2070500, while the url for the same article in the regular site is http://www.haaretz.co.il/news/world/middle-east/.premium-1.2070500. This of course got me curious and a quick check showed that there is no problem accessing the mobile version from a desktop browser. So I went a head and wrote a simple proof-of-concept Greasemonkey script to demonstrate replacing missing premium content in the desktop site by content intended for the smartphone app.

// ==UserScript==
// @name        Haaretz Premium Bypass
// @namespace   http://www.guyrutenberg.com/
// @description Replaces premium content with free content intended for smartphones.
// @require       https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js
// @include     http://www.haaretz.co.il/news/*/.premium-*
// @include     http://www.haaretz.co.il/opinions/.premium-*
// @include     http://www.haaretz.co.il/gallery/*/.premium-*
// @include     http://www.haaretz.co.il/captain/*/.premium-*
// @include     http://www.haaretz.co.il/magazine/*/.premium-*
// @include     http://www.haaretz.co.il/magazine/.premium-*
// @include     http://www.haaretz.co.il/literature/*/.premium-*
// @version     1
// ==/UserScript==
//
//

// hack: only execute for top-level document
if (window.top != window.self) {
    return;
}

var url = window.location.toString();
var index = url.indexOf('.premium-');
var mobile_url = "http://www.haaretz.co.il/misc/smartphone-article/"
mobile_url += url.substr(index);
$.get(mobile_url, function(data) {
    var article = $(data).filter('div.def_font:eq(1)');
    $('#article-box').html(article.html());
});

The script is just a POC and not intended to abuse Haaretz. If you like their stories then buy a subscription.

2 thoughts on “Haaretz Premium Bypass Userscript POC

  1. danni

    If you like them you should buy an account, as we say in the OS community free != free beer.

  2. Guy Post author

    You’re right, I’ve also ended my post with saying that this is just a POC of and if you enjoy Haaretz’s stories you should pay.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.