mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix #6302 (a change in the index-page broke the "Der Tagesspiegel"-recipe)
This commit is contained in:
parent
e2c048e23a
commit
2a39e43655
@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
|
|
||||||
class TagesspiegelRSS(BasicNewsRecipe):
|
class TagesspiegelRSS(BasicNewsRecipe):
|
||||||
title = u'Der Tagesspiegel'
|
title = u'Der Tagesspiegel'
|
||||||
__author__ = 'ipaschke'
|
__author__ = 'Ingo Paschke'
|
||||||
language = 'de'
|
language = 'de'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
@ -39,25 +39,30 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
dict(name='link'), dict(name='iframe'),dict(name='style'),dict(name='meta'),dict(name='button'),
|
dict(name='link'), dict(name='iframe'),dict(name='style'),dict(name='meta'),dict(name='button'),
|
||||||
dict(name='div', attrs={'class':["hcf-jump-to-comments","hcf-clear","hcf-magnify hcf-media-control"] }),
|
dict(name='div', attrs={'class':["hcf-jump-to-comments","hcf-clear","hcf-magnify hcf-media-control"] }),
|
||||||
dict(name='span', attrs={'class':["hcf-mainsearch",] }),
|
dict(name='span', attrs={'class':["hcf-mainsearch",] }),
|
||||||
dict(name='ul', attrs={'class':["hcf-tools"] }),
|
dict(name='ul', attrs={'class':["hcf-tools"]}),
|
||||||
|
dict(name='ul', attrs={'class': re.compile('hcf-services')})
|
||||||
]
|
]
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/')
|
soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/')
|
||||||
|
|
||||||
def feed_title(div):
|
def feed_title(div):
|
||||||
return ''.join(div.findAll(text=True, recursive=False)).strip()
|
return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None
|
||||||
|
|
||||||
articles = {}
|
articles = {}
|
||||||
key = None
|
key = None
|
||||||
ans = []
|
ans = []
|
||||||
|
maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')})
|
||||||
|
|
||||||
for div in soup.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}):
|
for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}):
|
||||||
|
|
||||||
if div['class'] == 'hcf-header':
|
if div['class'] == 'hcf-header':
|
||||||
|
try:
|
||||||
key = string.capwords(feed_title(div.em.a))
|
key = string.capwords(feed_title(div.em.a))
|
||||||
articles[key] = []
|
articles[key] = []
|
||||||
ans.append(key)
|
ans.append(key)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2':
|
elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2':
|
||||||
a = div.find('a', href=True)
|
a = div.find('a', href=True)
|
||||||
@ -84,3 +89,4 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user