mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix Der Tagesspiegel
This commit is contained in:
parent
8a3dedc7eb
commit
b13b7f8a50
@ -34,7 +34,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
no_javascript = True
|
no_javascript = True
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
remove_tags = [{'class':'hcf-header'}, {'class':'hcf-atlas'}, {'class':'hcf-date hcf-separate'}]
|
remove_tags = [{'class':'hcf-header'}, {'class':'hcf-atlas'}, {'class':'hcf-colon'}, {'class':'hcf-date hcf-separate'}]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
url = url.split('/')
|
url = url.split('/')
|
||||||
@ -51,6 +51,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None
|
return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None
|
||||||
|
|
||||||
articles = {}
|
articles = {}
|
||||||
|
links = set()
|
||||||
key = None
|
key = None
|
||||||
ans = []
|
ans = []
|
||||||
maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')})
|
maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')})
|
||||||
@ -59,7 +60,7 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
|
|
||||||
if div['class'] == 'hcf-header':
|
if div['class'] == 'hcf-header':
|
||||||
try:
|
try:
|
||||||
key = string.capwords(feed_title(div.em.a))
|
key = string.capwords(feed_title(div.em))
|
||||||
articles[key] = []
|
articles[key] = []
|
||||||
ans.append(key)
|
ans.append(key)
|
||||||
except:
|
except:
|
||||||
@ -70,6 +71,12 @@ class TagesspiegelRSS(BasicNewsRecipe):
|
|||||||
if not a:
|
if not a:
|
||||||
continue
|
continue
|
||||||
url = 'http://www.tagesspiegel.de' + a['href']
|
url = 'http://www.tagesspiegel.de' + a['href']
|
||||||
|
|
||||||
|
# check for duplicates
|
||||||
|
if url in links:
|
||||||
|
continue
|
||||||
|
links.add(url)
|
||||||
|
|
||||||
title = self.tag_to_string(a, use_alt=True).strip()
|
title = self.tag_to_string(a, use_alt=True).strip()
|
||||||
description = ''
|
description = ''
|
||||||
pubdate = strftime('%a, %d %b')
|
pubdate = strftime('%a, %d %b')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user