mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update LWN Weekly
Fix #809 (lwn weekly shows "Unknown feed" and "Undefined article title" for almost all TOC items)
This commit is contained in:
parent
1c20f656d2
commit
7eea7600ae
@ -83,7 +83,7 @@ class WeeklyLWN(BasicNewsRecipe):
|
||||
articles = {}
|
||||
ans = []
|
||||
|
||||
section = soup.title.string
|
||||
section = self.tag_to_string(soup.title)
|
||||
subsection = None
|
||||
|
||||
while True:
|
||||
@ -93,16 +93,16 @@ class WeeklyLWN(BasicNewsRecipe):
|
||||
if curr is None:
|
||||
break
|
||||
|
||||
text = curr.contents[0].string
|
||||
text = self.tag_to_string(curr.contents[0])
|
||||
|
||||
if 'Cat2HL' in curr.attrMap['class']:
|
||||
if 'Cat2HL' in curr['class']:
|
||||
subsection = text
|
||||
|
||||
elif 'Cat1HL' in curr.attrMap['class']:
|
||||
elif 'Cat1HL' in curr['class']:
|
||||
section = text
|
||||
subsection = None
|
||||
|
||||
elif 'SummaryHL' in curr.attrMap['class']:
|
||||
elif 'SummaryHL' in curr['class']:
|
||||
article_title = text
|
||||
if not article_title:
|
||||
article_title = _('Undefined article title')
|
||||
@ -125,7 +125,7 @@ class WeeklyLWN(BasicNewsRecipe):
|
||||
continue
|
||||
|
||||
else:
|
||||
print >>sys.stderr, 'article_anchor is None for "%s"; skipping' % article_title
|
||||
self.log.warn('article_anchor is None for "%s"; skipping' % article_title)
|
||||
article_url = None
|
||||
continue
|
||||
|
||||
@ -141,7 +141,7 @@ class WeeklyLWN(BasicNewsRecipe):
|
||||
})
|
||||
|
||||
else:
|
||||
print >>sys.stderr, "lwn_weekly.recipe: something bad happened; should not be able to reach this"
|
||||
self.log.error("lwn_weekly.recipe: something bad happened; should not be able to reach this")
|
||||
|
||||
ans = [(section2, articles[section2])
|
||||
for section2 in ans if section2 in articles]
|
||||
|
Loading…
x
Reference in New Issue
Block a user