From 6eb1036f422fb0c65cc381a3dcaa5cd3618361a4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Dec 2009 11:00:37 -0700 Subject: [PATCH] Economist free recipe: respect proxy settings --- resources/recipes/economist_free.recipe | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/recipes/economist_free.recipe b/resources/recipes/economist_free.recipe index f7c1b3816f..7c27764b8d 100644 --- a/resources/recipes/economist_free.recipe +++ b/resources/recipes/economist_free.recipe @@ -3,7 +3,6 @@ from calibre.utils.threadpool import ThreadPool, makeRequests import time from datetime import datetime from lxml import html -from urllib2 import urlopen class Economist(BasicNewsRecipe): @@ -45,10 +44,12 @@ class Economist(BasicNewsRecipe): return [(t, a) for t, a in self.feed_dict.items()] def process_eco_feed_article(self, args): + from calibre import browser i, url, title, description, author, published = args - ret = urlopen(url) + br = browser() + ret = br.open(url) raw = ret.read() - url = ret.geturl().replace('displaystory', 'PrinterFriendly').strip() + url = br.geturl().replace('displaystory', 'PrinterFriendly').strip() root = html.fromstring(raw) matches = root.xpath('//*[@class = "article-section"]') feedtitle = 'Miscellaneous'