mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-14 16:18:05 -04:00
...
This commit is contained in:
parent
4b31a1eb1c
commit
e972119109
@ -55,13 +55,15 @@ class AssociatedPress(BasicNewsRecipe):
|
||||
self.log('Processing section:', front, 'at', url)
|
||||
data = self.index_to_soup(url, raw=True)
|
||||
data = json.loads(data)
|
||||
from pprint import pformat
|
||||
open('/t/raw', 'wb').write(pformat(data))
|
||||
cards = data.get('cards', ())
|
||||
articles = []
|
||||
|
||||
for card in cards:
|
||||
for article in card['contents']:
|
||||
url = article['localLinkUrl']
|
||||
title = article.get('flattenedFirstWords')
|
||||
title = article.get('headline', article.get('flattenedFirstWords'))
|
||||
if not title:
|
||||
continue
|
||||
title = title.split('\u2014')[-1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user