mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Improved telepolis
This commit is contained in:
parent
fc524ee7d4
commit
27d52c02eb
@ -3,12 +3,12 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Gerhard Aigner <gerhard.aigner at gmail.com>'
|
__copyright__ = '2009, Gerhard Aigner <gerhard.aigner at gmail.com>'
|
||||||
|
|
||||||
''' http://www.derstandard.at - Austrian Newspaper '''
|
|
||||||
import re
|
import re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class TelepolisNews(BasicNewsRecipe):
|
class TelepolisNews(BasicNewsRecipe):
|
||||||
title = u'Telepolis (News)'
|
title = u'Telepolis (News+Artikel)'
|
||||||
__author__ = 'Gerhard Aigner'
|
__author__ = 'Gerhard Aigner'
|
||||||
publisher = 'Heise Zeitschriften Verlag GmbH & Co KG'
|
publisher = 'Heise Zeitschriften Verlag GmbH & Co KG'
|
||||||
description = 'News from telepolis'
|
description = 'News from telepolis'
|
||||||
@ -20,16 +20,16 @@ class TelepolisNews(BasicNewsRecipe):
|
|||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
language = 'de_AT'
|
language = 'de_AT'
|
||||||
|
|
||||||
use_embedded_content = False
|
use_embedded_content =False
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
|
|
||||||
preprocess_regexps = [(re.compile(r'<a[^>]*>', re.DOTALL|re.IGNORECASE), lambda match: ''),
|
preprocess_regexps = [(re.compile(r'<a[^>]*>', re.DOTALL|re.IGNORECASE), lambda match: ''),
|
||||||
(re.compile(r'</a>', re.DOTALL|re.IGNORECASE), lambda match: ''),]
|
(re.compile(r'</a>', re.DOTALL|re.IGNORECASE), lambda match: ''),]
|
||||||
|
|
||||||
keep_only_tags = [dict(name = 'table',attrs={'class':'blogtable'})]
|
keep_only_tags = [dict(name = 'td',attrs={'class':'bloghead'}),dict(name = 'td',attrs={'class':'blogfliess'})]
|
||||||
remove_tags = [dict(name='img'), dict(name='td',attrs={'class':'blogbottom'})]
|
remove_tags = [dict(name='img'), dict(name='td',attrs={'class':'blogbottom'}), dict(name='td',attrs={'class':'forum'})]
|
||||||
|
|
||||||
feeds = [(u'News', u'http://www.heise.de/tp/news.rdf')]
|
feeds = [(u'News', u'http://www.heise.de/tp/news-atom.xml')]
|
||||||
|
|
||||||
html2lrf_options = [
|
html2lrf_options = [
|
||||||
'--comment' , description
|
'--comment' , description
|
||||||
@ -41,7 +41,7 @@ class TelepolisNews(BasicNewsRecipe):
|
|||||||
|
|
||||||
def get_article_url(self, article):
|
def get_article_url(self, article):
|
||||||
'''if the linked article is of kind artikel don't take it'''
|
'''if the linked article is of kind artikel don't take it'''
|
||||||
if (article.link.count('artikel') > 0) :
|
if (article.link.count('artikel') > 1) :
|
||||||
return None
|
return None
|
||||||
return article.link
|
return article.link
|
||||||
|
|
||||||
@ -49,3 +49,5 @@ class TelepolisNews(BasicNewsRecipe):
|
|||||||
mtag = '<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '">'
|
mtag = '<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '">'
|
||||||
soup.head.insert(0,mtag)
|
soup.head.insert(0,mtag)
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user