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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. exiledonline.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class Exiled(BasicNewsRecipe):
  10.     title                 = 'Exiled Online'
  11.     __author__            = 'Darko Miletic'
  12.     description           = "Mankind's only alternative since 1997 - Formerly known as The eXile"
  13.     publisher             = 'Exiled Online'
  14.     category              = 'news, politics, international'
  15.     oldest_article        = 15
  16.     max_articles_per_feed = 100
  17.     no_stylesheets        = True
  18.     use_embedded_content  = False
  19.     encoding              = 'utf8'
  20.     remove_javascript     = True
  21.     language              = 'en'
  22.     publication_type      = 'newsblog'
  23.     masthead_url          = 'http://exiledonline.com/wp-content/themes/exiledonline_theme/images/header-sm.gif'
  24.     extra_css             = """
  25.                                body{font-family: Arial,Helvetica,sans-serif}
  26.                                #topslug{font-size: xx-large; font-weight: bold; color: red}                               
  27.                             """
  28.     
  29.     conversion_options = {
  30.                           'comment'   : description
  31.                         , 'tags'      : category
  32.                         , 'publisher' : publisher
  33.                         , 'language'  : language
  34.                         }
  35.  
  36.     keep_only_tags = [dict(name='div', attrs={'id':'main'})]
  37.  
  38.     remove_tags = [
  39.                      dict(name=['object','link'])
  40.                     ,dict(name='div', attrs={'class':'info'})
  41.                     ,dict(name='div', attrs={'id':['comments','navig']})
  42.                   ]
  43.  
  44.  
  45.     feeds = [(u'Articles', u'http://exiledonline.com/feed/')]
  46.  
  47.     def preprocess_html(self, soup):
  48.         for item in soup.findAll(style=True):
  49.             del item['style']
  50.         for alink in soup.findAll('a'):
  51.             if alink.string is not None:
  52.                tstr = alink.string
  53.                alink.replaceWith(tstr)
  54.         return soup
  55.  
  56.     def get_article_url(self, article):
  57.         raw = article.get('link',  None)
  58.         final = raw + 'all/1/'
  59.         return final
  60.