home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_3912 < prev    next >
Encoding:
Text File  |  2010-09-30  |  1.9 KB  |  54 lines

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, NA'
  3. '''
  4. consumerist.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class Consumerist(BasicNewsRecipe):
  10.     title                 = 'Consumerist'
  11.     __author__            = 'NA'
  12.     description           = "Consumerist, Shoppers Bite Back."
  13.     publisher             = 'consumerist.com'
  14.     category              = 'news, consumer news, consumer rights'
  15.     oldest_article        = 2
  16.     max_articles_per_feed = 100
  17.     no_stylesheets        = True
  18.     encoding              = 'utf-8'
  19.     use_embedded_content  = False
  20.     language              = 'en'
  21.     masthead_url          = 'http://consumerist.com/css/images/footer_man.gif'
  22.     extra_css             = '''
  23.     body{font-family: "Lucida Grande",Helvetica,Arial,sans-serif}
  24.     img{margin-bottom: 1em}
  25.     h1{font-family :Arial,Helvetica,sans-serif; font-size:x-large}
  26.     h2{font-family :Arial,Helvetica,sans-serif; font-size:large}
  27.                   '''
  28.     conversion_options = {
  29.                           'comment'   : description
  30.                         , 'tags'      : category
  31.                         , 'publisher' : publisher
  32.                         , 'language'  : language
  33.                         }
  34.  
  35.     remove_attributes  = ['width','height']
  36.     #keep_only_tags     = [dict(attrs={'class':['', 'category-breadcrumb']}),]
  37.     remove_tags_before = dict(name='h2')
  38.  
  39.     remove_tags = [
  40.        #dict(name='iframe'),
  41.        dict(name='div', attrs={'class':['e-comments', 'more-about', 'entry-tags']}),
  42.        #dict(name='div', attrs={'id':['IEContainer', 'clickIncludeBox']}),
  43.        #dict(name='ul', attrs={'class':'article-tools'}),
  44.        #dict(name='ul', attrs={'class':'articleTools'}),
  45.     ]
  46.  
  47.     remove_tags_after  = dict(attrs={'class':'e-body'})
  48.  
  49.     feeds = [(u'Articles', u'http://consumerist.com/index.xml')]
  50.  
  51.     def preprocess_html(self, soup):
  52.         return self.adeify_images(soup)
  53.  
  54.