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

  1. __license__  = 'GPL v3'
  2. __copyright__ = "2008, Derry FitzGerald. 2009 Modified by Ray Kinsella and David O'Callaghan, 2011 Modified by Phil Burns"
  3. '''
  4. irishtimes.com
  5. '''
  6. import re
  7.  
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class IrishTimes(BasicNewsRecipe):
  11.     title          = u'The Irish Times'
  12.     encoding  = 'ISO-8859-15'
  13.     __author__    = "Derry FitzGerald, Ray Kinsella, David O'Callaghan and Phil Burns"
  14.     language = 'en_IE'
  15.     timefmt = ' (%A, %B %d, %Y)'
  16.  
  17.  
  18.     oldest_article = 1.0
  19.     max_articles_per_feed  = 100
  20.     no_stylesheets = True
  21.     simultaneous_downloads= 5
  22.  
  23.     r = re.compile('.*(?P<url>http:\/\/(www.irishtimes.com)|(rss.feedsportal.com\/c)\/.*\.html?).*')
  24.     remove_tags    = [dict(name='div', attrs={'class':'footer'})]
  25.     extra_css      = 'p, div { margin: 0pt; border: 0pt; text-indent: 0.5em } .headline {font-size: large;} \n .fact { padding-top: 10pt  }'
  26.  
  27.     feeds          = [
  28.                       ('Frontpage', 'http://www.irishtimes.com/feeds/rss/newspaper/index.rss'),
  29.                       ('Ireland', 'http://www.irishtimes.com/feeds/rss/newspaper/ireland.rss'),
  30.                       ('World', 'http://www.irishtimes.com/feeds/rss/newspaper/world.rss'),
  31.                       ('Finance', 'http://www.irishtimes.com/feeds/rss/newspaper/finance.rss'),
  32.                       ('Features', 'http://www.irishtimes.com/feeds/rss/newspaper/features.rss'),
  33.                       ('Sport', 'http://www.irishtimes.com/feeds/rss/newspaper/sport.rss'),
  34.                       ('Opinion', 'http://www.irishtimes.com/feeds/rss/newspaper/opinion.rss'),
  35.                       ('Letters', 'http://www.irishtimes.com/feeds/rss/newspaper/letters.rss'),
  36.                       ('Magazine', 'http://www.irishtimes.com/feeds/rss/newspaper/magazine.rss'),
  37.                       ('Health', 'http://www.irishtimes.com/feeds/rss/newspaper/health.rss'),
  38.                       ('Education & Parenting', 'http://www.irishtimes.com/feeds/rss/newspaper/education.rss'),
  39.                       ('Motors', 'http://www.irishtimes.com/feeds/rss/newspaper/motors.rss'),
  40.                       ('An Teanga Bheo', 'http://www.irishtimes.com/feeds/rss/newspaper/anteangabheo.rss'),
  41.                       ('Commercial Property', 'http://www.irishtimes.com/feeds/rss/newspaper/commercialproperty.rss'),
  42.                       ('Science Today', 'http://www.irishtimes.com/feeds/rss/newspaper/sciencetoday.rss'),
  43.                       ('Property', 'http://www.irishtimes.com/feeds/rss/newspaper/property.rss'),
  44.                       ('The Tickets', 'http://www.irishtimes.com/feeds/rss/newspaper/theticket.rss'),
  45.                       ('Weekend', 'http://www.irishtimes.com/feeds/rss/newspaper/weekend.rss'),
  46.                       ('News features', 'http://www.irishtimes.com/feeds/rss/newspaper/newsfeatures.rss'),
  47.                       ('Obituaries', 'http://www.irishtimes.com/feeds/rss/newspaper/obituaries.rss'),
  48.                     ]
  49.  
  50.  
  51.     def print_version(self, url):
  52.         if url.count('rss.feedsportal.com'):
  53.             #u = url.replace('0Bhtml/story01.htm','_pf0Bhtml/story01.htm')
  54.             u = url.find('irishtimes')
  55.             u = 'http://www.irishtimes.com' + url[u + 12:]
  56.             u = u.replace('0C', '/')
  57.             u = u.replace('A', '')
  58.             u = u.replace('0Bhtml/story01.htm', '_pf.html')
  59.         else:
  60.             u = url.replace('.html','_pf.html')
  61.         return u
  62.  
  63.     def get_article_url(self, article):
  64.         return article.link
  65.  
  66.