home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3634 < prev    next >
Encoding:
Text File  |  2010-07-03  |  2.7 KB  |  65 lines

  1. from calibre.web.feeds.news import BasicNewsRecipe
  2.  
  3. class BigOven(BasicNewsRecipe):
  4.     title               = 'BigOven'
  5.     __author__          = 'Starson17'
  6.     description         = 'Recipes for the Foodie in us all. Registration is free. A fake username and password just gives smaller photos.'
  7.     language            = 'en'
  8.     category            = 'news, food, recipes, gourmet'
  9.     publisher           = 'Starson17'
  10.     use_embedded_content= False
  11.     no_stylesheets      = True
  12.     oldest_article      = 24
  13.     remove_javascript   = True
  14.     remove_empty_feeds    = True
  15.     cover_url           = 'http://www.software.com/images/products/BigOven%20Logo_177_216.JPG'
  16.     max_articles_per_feed = 30
  17.     needs_subscription = True
  18.  
  19.     conversion_options = {'linearize_tables'  : True
  20.                         , 'comment'           : description
  21.                         , 'tags'              : category
  22.                         , 'publisher'         : publisher
  23.                         , 'language'          : language
  24.                         }
  25.  
  26.     def get_browser(self):
  27.         br = BasicNewsRecipe.get_browser()
  28.         if self.username is not None and self.password is not None:
  29.             br.open('http://www.bigoven.com/')
  30.             br.select_form(name='form1')
  31.             br['TopMenu_bo1$email']  = self.username
  32.             br['TopMenu_bo1$password'] = self.password
  33.             br.submit()
  34.         return br
  35.  
  36.     remove_attributes = ['style', 'font']
  37.  
  38.     keep_only_tags     = [dict(name='h1')
  39.                           ,dict(name='div', attrs={'class':'img'})
  40.                           ,dict(name='div', attrs={'id':'intro'})
  41.                           ]
  42.  
  43.     remove_tags = [dict(name='div', attrs={'style':["overflow: visible;"]})
  44.                    ,dict(name='div', attrs={'class':['ctas']})
  45.                    #,dict(name='a', attrs={'class':['edit']})
  46.                    ,dict(name='p', attrs={'class':['byline']})
  47.                    ]
  48.  
  49.     feeds = [(u'4 & 5 Star Rated Recipes', u'http://feeds.feedburner.com/Bigovencom-RecipeRaves?format=xml')]
  50.  
  51.     def preprocess_html(self, soup):
  52.         for tag in soup.findAll(name='a', attrs={'class':['edit']}):
  53.           tag.parent.extract()
  54.         for tag in soup.findAll(name='a', attrs={'class':['deflink']}):
  55.           tag.replaceWith(tag.string)
  56.         return soup
  57.  
  58.     extra_css = '''
  59.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  60.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:medium;}
  61.                     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  62.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  63.                     '''
  64.  
  65.