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

  1. from calibre.web.feeds.news import BasicNewsRecipe
  2.  
  3. class BangkokPostRecipe(BasicNewsRecipe):
  4.     __license__  = 'GPL v3'
  5.     __author__ = 'kwetal'
  6.     language = 'en_TH'
  7.     version = 1
  8.  
  9.     title = u'Bangkok Post'
  10.     publisher = u'Post Publishing PCL'
  11.     category = u'News'
  12.     description = u'The world\'s window to Thailand'
  13.  
  14.     oldest_article = 7
  15.     max_articles_per_feed = 100
  16.  
  17.     no_stylesheets = True
  18.     remove_javascript = True
  19.     use_embedded_content = False
  20.  
  21.     # Feeds from: http://www.bangkokpost.com/rss/
  22.     feeds = []
  23.     feeds.append((u'Breaking News', u'http://www.bangkokpost.com/rss/data/breakingnews.xml'))
  24.     feeds.append((u'Top Stories', u'http://www.bangkokpost.com/rss/data/topstories.xml'))
  25.     feeds.append((u'News', u'http://www.bangkokpost.com/rss/data/news.xml'))
  26.     feeds.append((u'Business', u'http://www.bangkokpost.com/rss/data/business.xml'))
  27.     feeds.append((u'Opinion', u'http://www.bangkokpost.com/rss/data/opinion.xml'))
  28.     feeds.append((u'Travel', u'http://www.bangkokpost.com/rss/data/travel.xml'))
  29.     feeds.append((u'Leisure', u'http://www.bangkokpost.com/rss/data/leisure.xml'))
  30.     feeds.append((u'Entertainment', u'http://www.bangkokpost.com/rss/data/entertainment.xml'))
  31.     feeds.append((u'Auto', u'http://www.bangkokpost.com/rss/data/auto.xml'))
  32.     feeds.append((u'Life', u'http://www.bangkokpost.com/rss/data/life.xml'))
  33.     feeds.append((u'Tech', u'http://www.bangkokpost.com/rss/data/tect.xml'))
  34.  
  35.     keep_only_tags = []
  36.     keep_only_tags.append(dict(name = 'div', attrs = {'class' : 'entry'}))
  37.  
  38.     remove_tags = []
  39.     remove_tags.append(dict(name = 'div', attrs = {'class': 'article-features'}))
  40.     remove_tags.append(dict(name = 'div', attrs = {'class': 'socialBookmark'}))
  41.     remove_tags.append(dict(name = 'div', attrs = {'id': 'main-sns'}))
  42.     # Their YouTube movies are displayed in an iframe, if you want those you will have to parse the articles by hand.
  43.     # Setting self.recursion to 1, which might resolve this, makes calibre downloading a lot of PDF files, which will cause a very, very very, long download time
  44.     remove_tags.append(dict(name = 'iframe'))
  45.  
  46.