mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Get descriptions as well when parsing economist index page
This commit is contained in:
parent
40e91596fb
commit
a7789552df
@ -268,8 +268,14 @@ class Economist(BasicNewsRecipe):
|
||||
title = u'{}: {}'.format(*map(self.tag_to_string, spans))
|
||||
else:
|
||||
title = self.tag_to_string(a)
|
||||
articles.append({'title': title, 'url': process_url(a['href'])})
|
||||
self.log(' ', title, articles[-1]['url'])
|
||||
desc = ''
|
||||
desc_parent = a.findParent('div')
|
||||
if desc_parent is not None:
|
||||
p = desc_parent.find(itemprop='description')
|
||||
if p is not None:
|
||||
desc = self.tag_to_string(p)
|
||||
articles.append({'title': title, 'url': process_url(a['href']), 'description': desc})
|
||||
self.log(' ', title, articles[-1]['url'], '\n ', desc)
|
||||
if articles:
|
||||
feeds.append((secname, articles))
|
||||
return feeds
|
||||
|
@ -268,8 +268,14 @@ class Economist(BasicNewsRecipe):
|
||||
title = u'{}: {}'.format(*map(self.tag_to_string, spans))
|
||||
else:
|
||||
title = self.tag_to_string(a)
|
||||
articles.append({'title': title, 'url': process_url(a['href'])})
|
||||
self.log(' ', title, articles[-1]['url'])
|
||||
desc = ''
|
||||
desc_parent = a.findParent('div')
|
||||
if desc_parent is not None:
|
||||
p = desc_parent.find(itemprop='description')
|
||||
if p is not None:
|
||||
desc = self.tag_to_string(p)
|
||||
articles.append({'title': title, 'url': process_url(a['href']), 'description': desc})
|
||||
self.log(' ', title, articles[-1]['url'], '\n ', desc)
|
||||
if articles:
|
||||
feeds.append((secname, articles))
|
||||
return feeds
|
||||
|
Loading…
x
Reference in New Issue
Block a user