Fix the Opinion section of the no subscription NYTimes recipe

This commit is contained in:
Kovid Goyal 2009-03-08 22:10:05 -07:00
parent 8dcb895f79
commit 4df17ef032
3 changed files with 9 additions and 3 deletions

View File

@ -70,10 +70,14 @@ class NYTimesMobile(BasicNewsRecipe):
def find_articles(self, root):
for a in root.xpath('//a[@accesskey]'):
href = a.get('href')
if href.startswith('http://'):
url = href
else:
url = 'http://mobile.nytimes.com/article' + href[href.find('?'):]+'&single=1',
yield {
'title': a.text.strip(),
'date' : '',
'url' : 'http://mobile.nytimes.com/article' + href[href.find('?'):]+'&single=1',
'url' : url,
'description': '',
}

View File

@ -75,7 +75,9 @@ class NYTimes(BasicNewsRecipe):
dict(title=title, url=url, date=pubdate,
description=description,
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)]
return ans