View Single Post
Old 02-10-2010, 12:27 PM   #1412
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Dilbert - Larger images.

I read ebooks from a 10 foot interface. The Dilbert comic strip is a bit too small for me. Here's a modified version of the Dilbert recipe that grabs larger images.

Code:
__license__   = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
http://www.dilbert.com
'''

from calibre.web.feeds.recipes import BasicNewsRecipe
import re

class DilbertBig(BasicNewsRecipe):
    title                  = 'DilbertBig'
    __author__             = 'Darko Miletic - big images added by Starson17'
    description            = 'DilbertBig'
    oldest_article         = 5
    max_articles_per_feed  = 100
    no_stylesheets         = True
    use_embedded_content   = True
    encoding               = 'utf-8'
    publisher              = 'UNITED FEATURE SYNDICATE, INC.'
    category               = 'comic'
    language               = 'en'

    conversion_options = {
                             'comments'        : description
                            ,'tags'            : category
                            ,'language'        : language
                            ,'publisher'       : publisher
                         }

    feeds = [(u'Dilbert', u'http://feeds.dilbert.com/DilbertDailyStrip' )]

    def get_article_url(self, article):
        return article.get('feedburner_origlink', None)

    preprocess_regexps = [
        (re.compile('strip\..*\.gif', re.DOTALL|re.IGNORECASE), lambda match: 'strip.zoom.gif')
        ]

    def preprocess_html(self, soup):
       for tag in soup.findAll(name='a'):
           if tag['href'].find('http://feedads') >= 0:
              tag.extract()
       return soup
Starson17 is offline