mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Economist free recipe: respect proxy settings
This commit is contained in:
parent
d8ba028e1f
commit
6eb1036f42
@ -3,7 +3,6 @@ from calibre.utils.threadpool import ThreadPool, makeRequests
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from lxml import html
|
from lxml import html
|
||||||
from urllib2 import urlopen
|
|
||||||
|
|
||||||
class Economist(BasicNewsRecipe):
|
class Economist(BasicNewsRecipe):
|
||||||
|
|
||||||
@ -45,10 +44,12 @@ class Economist(BasicNewsRecipe):
|
|||||||
return [(t, a) for t, a in self.feed_dict.items()]
|
return [(t, a) for t, a in self.feed_dict.items()]
|
||||||
|
|
||||||
def process_eco_feed_article(self, args):
|
def process_eco_feed_article(self, args):
|
||||||
|
from calibre import browser
|
||||||
i, url, title, description, author, published = args
|
i, url, title, description, author, published = args
|
||||||
ret = urlopen(url)
|
br = browser()
|
||||||
|
ret = br.open(url)
|
||||||
raw = ret.read()
|
raw = ret.read()
|
||||||
url = ret.geturl().replace('displaystory', 'PrinterFriendly').strip()
|
url = br.geturl().replace('displaystory', 'PrinterFriendly').strip()
|
||||||
root = html.fromstring(raw)
|
root = html.fromstring(raw)
|
||||||
matches = root.xpath('//*[@class = "article-section"]')
|
matches = root.xpath('//*[@class = "article-section"]')
|
||||||
feedtitle = 'Miscellaneous'
|
feedtitle = 'Miscellaneous'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user