mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix the Opinion section of the no subscription NYTimes recipe
This commit is contained in:
parent
8dcb895f79
commit
4df17ef032
@ -70,10 +70,14 @@ class NYTimesMobile(BasicNewsRecipe):
|
|||||||
def find_articles(self, root):
|
def find_articles(self, root):
|
||||||
for a in root.xpath('//a[@accesskey]'):
|
for a in root.xpath('//a[@accesskey]'):
|
||||||
href = a.get('href')
|
href = a.get('href')
|
||||||
|
if href.startswith('http://'):
|
||||||
|
url = href
|
||||||
|
else:
|
||||||
|
url = 'http://mobile.nytimes.com/article' + href[href.find('?'):]+'&single=1',
|
||||||
yield {
|
yield {
|
||||||
'title': a.text.strip(),
|
'title': a.text.strip(),
|
||||||
'date' : '',
|
'date' : '',
|
||||||
'url' : 'http://mobile.nytimes.com/article' + href[href.find('?'):]+'&single=1',
|
'url' : url,
|
||||||
'description': '',
|
'description': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,9 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
dict(title=title, url=url, date=pubdate,
|
dict(title=title, url=url, date=pubdate,
|
||||||
description=description,
|
description=description,
|
||||||
content=''))
|
content=''))
|
||||||
ans = self.sort_index_by(ans, {'The Front Page':-1, 'Dining In, Dining Out':1, 'Obituaries':2})
|
ans = self.sort_index_by(ans, {'The Front Page':-1,
|
||||||
|
'Dining In, Dining Out':1,
|
||||||
|
'Obituaries':2})
|
||||||
ans = [(key, articles[key]) for key in ans if articles.has_key(key)]
|
ans = [(key, articles[key]) for key in ans if articles.has_key(key)]
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class USAToday(BasicNewsRecipe):
|
|||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return 'http://www.printthis.clickability.com/pt/printThis?clickMap=printThis&fb=Y&url=' + url
|
return 'http://www.printthis.clickability.com/pt/printThis?clickMap=printThis&fb=Y&url=' + url
|
||||||
|
|
||||||
def postprocess_html(self, soup, first_fetch):
|
def postprocess_html(self, soup, first_fetch):
|
||||||
for t in soup.findAll(['table', 'tr', 'td']):
|
for t in soup.findAll(['table', 'tr', 'td']):
|
||||||
t.name = 'div'
|
t.name = 'div'
|
||||||
return soup
|
return soup
|
Loading…
x
Reference in New Issue
Block a user