· 9 years ago · Oct 01, 2016, 03:46 PM
1__license__ = 'GPL v3'
2__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
3'''
4http://www.dilbert.com
5DrMerry added cover Image 2011-11-12
6'''
7
8from calibre.web.feeds.recipes import BasicNewsRecipe
9from calibre.ebooks.BeautifulSoup import BeautifulSoup
10import re
11
12
13class DilbertBig(BasicNewsRecipe):
14 title = 'Dilbert'
15 __author__ = 'Darko Miletic and Starson17 contribution of DrMerry'
16 description = 'Dilbert'
17 reverse_article_order = True
18 oldest_article = 15
19 max_articles_per_feed = 100
20 no_stylesheets = True
21 use_embedded_content = False
22 encoding = 'utf-8'
23 publisher = 'UNITED FEATURE SYNDICATE, INC.'
24 category = 'comic'
25 language = 'en'
26 cover_url = 'http://dilbert.com/mobile/mobile/dilbert.app.icon.png'
27
28 conversion_options = {
29 'comments': description, 'tags': category, 'language': language, 'publisher': publisher
30 }
31
32 feeds = [(u'Dilbert', u'http://feed.dilbert.com/dilbert/daily_strip')]
33
34 preprocess_regexps = [
35 (re.compile('strip\..*\.gif', re.DOTALL | re.IGNORECASE),
36 lambda match: 'strip.zoom.gif')
37 ]
38
39 def preprocess_html(self, soup):
40 for tag in soup.findAll(name='input'):
41 image = BeautifulSoup('<img src=' + tag['value'] + '></img>')
42 return image