home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / sb_nation.recipe < prev    next >
Text File  |  2011-09-09  |  2KB  |  57 lines

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = 'Zotzo'
  5. '''
  6. http://www.stumptownfooty.com/
  7. http://www.eightysixforever.com
  8. http://www.sounderatheart.com
  9. http://www.dailysoccerfix.com/
  10.  
  11. '''
  12. from calibre.web.feeds.news import BasicNewsRecipe
  13.  
  14. class SBNation(BasicNewsRecipe):
  15.     title    = u'SBNation'
  16.     __author__ = 'rylsfan'
  17.     description           = u"More than 290 individual communities, each offering high quality year-round coverage and conversation led by fans who are passionate."
  18.     oldest_article        = 3
  19.     language = 'en'
  20.     max_articles_per_feed = 100
  21.     no_stylesheets        = True
  22.     use_embedded_content  = False
  23.  
  24.     #cover_url = 'http://img132.imageshack.us/img132/4913/2hyggjegqqdywzn9.png'
  25.  
  26.     keep_only_tags = [
  27.                         dict(name='h2', attrs={'class':'title'})
  28.                        ,dict(name='div', attrs={'class':'entry-body'})
  29.                      ]
  30.  
  31.     remove_tags_after = dict(name='div', attrs={'class':'footline entry-actions'})
  32.     remove_tags = [
  33.                      dict(name='div', attrs={'class':'footline entry-actions'}),
  34.                      {'class': 'extend-divide'}
  35.                   ]
  36.     # SBNation has 300 special blogs to choose from. These are just a couple!
  37.     feeds       =  [
  38.                        (u'Daily Fix', u'http://www.dailysoccerfix.com/rss/'),
  39.                        (u"Stumptown Footy", u'http://www.stumptownfooty.com/rss/'),
  40.                        (u'Sounders', u'http://www.sounderatheart.com/rss/'),
  41.                        (u'Whitecaps', u'http://www.eightysixforever.com/rss/'),
  42.                    ]
  43.  
  44.     extra_css  =   """
  45.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  46.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  47.                     p{font-family:Helvetica,sans-serif; display: block; text-align: left; text-decoration: none; text-indent: 0%;}
  48.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  49.                          """
  50.  
  51.     def preprocess_html(self, soup):
  52.         return self.adeify_images(soup)
  53.  
  54.     def populate_article_metadata(self, article, soup, first):
  55.        h2 = soup.find('h2')
  56.        h2.replaceWith(h2.prettify() + '<p><em> By ' + article.author + '</em></p>')
  57.