View Single Post
Old 11-06-2014, 05:08 PM   #27
MoiMoiMoi
Junior Member
MoiMoiMoi began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Nov 2014
Device: kindle
Hello,

It is indeed related to the cookie acceptance notice.
Using wget to get the page
http//www.economist.com/printedition without any cookie gives a page that contains:

<title>Explicit cookie consent | The Economist</title>


However, the same page also contains the following javascript code:

Function checkForAcceptance() {
if (document.cookie.indexOf('notice_preferences') !== -1) {
if (window.location.href.indexOf('explicit-cookie-consent.html') === -1) {
window.location.reload();
}
else {
window.location = '/';
window.location.replace('/');
}
}
else {
setTimeout(checkForAcceptance, 100);
}
}
// Start the watch off.
checkForAcceptance();


So... setting the "notice_preferences" cookie should do the trick.

Starting from:
https://github.com/kovidgoyal/calibr...st_free.recipe

1. Uncomment the lines 61-75 (the get_browser function)
2. Add the following lines after line 63:

import cookielib
ck = cookielib.Cookie(version=0, name='notice_preferences', value='2:',
port=None, port_specified=False, domain='.economist.com',
domain_specified=False, domain_initial_dot=True,
path='/', path_specified=False, secure=False,
expires=None, discard=False, comment=None,
comment_url=None, rest={'HttpOnly': None}, rfc2109=False)
br.cookiejar.set_cookie(ck)

This make the recipe work for me (In France, calibre 2.3.0, Linux).

I am not posting this as a patch as I don't know nearly enough about cookies, mechanize and calibre to make it a proper patch. However, since the calibre author has seen this thread, maybe he can provide some advice.

Cheers.
MoiMoiMoi is offline   Reply With Quote