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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.athensnews.gr
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class AthensNews(BasicNewsRecipe):
  10.     title                 = 'Athens News'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'Greece in English since 1952'
  13.     publisher             = 'NEP Publishing Company SA'
  14.     category              = 'news, politics, Greece, Athens'
  15.     oldest_article        = 1
  16.     max_articles_per_feed = 200
  17.     no_stylesheets        = True
  18.     encoding              = 'utf8'
  19.     use_embedded_content  = False
  20.     language              = 'en_GR'
  21.     remove_empty_feeds    = True
  22.     publication_type      = 'newspaper'
  23.     masthead_url          = 'http://www.athensnews.gr/sites/athensnews/themes/athensnewsv3/images/logo.jpg'
  24.     extra_css             = """
  25.                                body{font-family: Arial,Helvetica,sans-serif }
  26.                                img{margin-bottom: 0.4em; display:block}
  27.                                .big{font-size: xx-large; font-family: Georgia,serif}
  28.                                .articlepubdate{font-size: small; color: gray; font-family: Georgia,serif}
  29.                                .lezanta{font-size: x-small; font-weight: bold; text-align: left; margin-bottom: 1em; display: block}
  30.                             """
  31.  
  32.     conversion_options = {
  33.                           'comment'          : description
  34.                         , 'tags'             : category
  35.                         , 'publisher'        : publisher
  36.                         , 'language'         : language
  37.                         , 'linearize_tables' : True
  38.                         }
  39.  
  40.     remove_tags = [
  41.                      dict(name=['meta','link'])
  42.                   ]
  43.     keep_only_tags=[
  44.                       dict(name='span',attrs={'class':'big'})
  45.                      ,dict(name='td', attrs={'class':['articlepubdate','text']})
  46.                    ]
  47.     remove_attributes=['lang']
  48.  
  49.  
  50.     feeds = [
  51.               (u'News'            , u'http://www.athensnews.gr/category/1/feed' )
  52.              ,(u'Politics'        , u'http://www.athensnews.gr/category/8/feed' )
  53.              ,(u'Business'        , u'http://www.athensnews.gr/category/2/feed' )
  54.              ,(u'Economy'         , u'http://www.athensnews.gr/category/11/feed')
  55.              ,(u'Community'       , u'http://www.athensnews.gr/category/5/feed' )
  56.              ,(u'Arts'            , u'http://www.athensnews.gr/category/3/feed' )
  57.              ,(u'Living in Athens', u'http://www.athensnews.gr/category/7/feed' )
  58.              ,(u'Sports'          , u'http://www.athensnews.gr/category/4/feed' )
  59.              ,(u'Travel'          , u'http://www.athensnews.gr/category/6/feed' )
  60.              ,(u'Letters'         , u'http://www.athensnews.gr/category/44/feed')
  61.              ,(u'Media'           , u'http://www.athensnews.gr/multimedia/feed' )
  62.             ]
  63.  
  64.     def print_version(self, url):
  65.         return url + '?action=print'
  66.  
  67.     def preprocess_html(self, soup):
  68.         for item in soup.findAll(style=True):
  69.             del item['style']
  70.         return soup
  71.