Update Dilbert and Antyweb
This commit is contained in:
Kovid Goyal 2013-07-25 07:47:36 +05:30
commit 9db39821b4
2 changed files with 9 additions and 31 deletions

View File

@ -21,21 +21,9 @@ class AntywebRecipe(BasicNewsRecipe):
simultaneous_downloads = 3 simultaneous_downloads = 3
keep_only_tags =[] keep_only_tags =[]
keep_only_tags.append(dict(name = 'h1', attrs = { 'class' : 'mm-article-title'})) keep_only_tags.append(dict(name = 'h1', attrs = { 'class' : 'entry-title '}))
keep_only_tags.append(dict(name = 'div', attrs = {'class' : 'mm-article-content'})) keep_only_tags.append(dict(name = 'div', attrs = {'class' : 'news-content'}))
extra_css = '''body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}'''
remove_tags =[]
remove_tags.append(dict(name = 'h2', attrs = {'class' : 'widgettitle'}))
remove_tags.append(dict(name = 'img', attrs = {'class' : 'alignleft'}))
remove_tags.append(dict(name = 'div', attrs = {'class' : 'float: right;margin-left:1em;margin-bottom: 0.5em;padding-bottom: 3px; width: 72px;'}))
remove_tags.append(dict(name = 'img', attrs = {'src' : 'http://antyweb.pl/wp-content/uploads/2011/09/HOSTERSI_testy_pasek600x30.gif'}))
remove_tags.append(dict(name = 'div', attrs = {'class' : 'podwpisowe'}))
extra_css = '''
body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
'''
feeds = [ feeds = [
(u'Artykuly', u'feed://feeds.feedburner.com/Antyweb?format=xml'), (u'Artykuly', u'feed://feeds.feedburner.com/Antyweb?format=xml'),

View File

@ -6,6 +6,7 @@ DrMerry added cover Image 2011-11-12
''' '''
from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
import re import re
class DilbertBig(BasicNewsRecipe): class DilbertBig(BasicNewsRecipe):
@ -16,7 +17,7 @@ class DilbertBig(BasicNewsRecipe):
oldest_article = 15 oldest_article = 15
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True
use_embedded_content = True use_embedded_content = False
encoding = 'utf-8' encoding = 'utf-8'
publisher = 'UNITED FEATURE SYNDICATE, INC.' publisher = 'UNITED FEATURE SYNDICATE, INC.'
category = 'comic' category = 'comic'
@ -30,25 +31,14 @@ class DilbertBig(BasicNewsRecipe):
,'publisher' : publisher ,'publisher' : publisher
} }
feeds = [(u'Dilbert', u'http://feed.dilbert.com/dilbert/daily_strip' )] feeds = [(u'Dilbert', u'http://feed.dilbert.com/dilbert/daily_strip')]
def get_article_url(self, article):
return article.get('feedburner_origlink', None)
preprocess_regexps = [ preprocess_regexps = [
(re.compile('strip\..*\.gif', re.DOTALL|re.IGNORECASE), lambda match: 'strip.zoom.gif') (re.compile('strip\..*\.gif', re.DOTALL|re.IGNORECASE), lambda match: 'strip.zoom.gif')
] ]
def preprocess_html(self, soup): def preprocess_html(self, soup):
for tag in soup.findAll(name='a'): for tag in soup.findAll(name='input'):
if tag['href'].find('http://feedads') >= 0: image = BeautifulSoup('<img src=' + tag['value'] + '></img>')
tag.extract() return image
return soup
extra_css = '''
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
img {max-width:100%; min-width:100%;}
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
'''