home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_4034 < prev    next >
Encoding:
Text File  |  2010-10-14  |  2.7 KB  |  59 lines

  1. #!/usr/bin/env  python
  2. __license__   = 'GPL v3'
  3.  
  4. __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
  5. __docformat__ = 'restructuredtext en'
  6.  
  7. '''
  8. globeandmail.com
  9. '''
  10.  
  11. from calibre.web.feeds.news import BasicNewsRecipe
  12.  
  13. class GlobeAndMail(BasicNewsRecipe):
  14.     title = u'Globe and Mail'
  15.     language = 'en_CA'
  16.  
  17.     __author__ = 'Kovid Goyal'
  18.     oldest_article = 2
  19.     max_articles_per_feed = 10
  20.     no_stylesheets = True
  21.     extra_css = '''
  22.     h3 {font-size: 22pt; font-weight:bold; margin:0px; padding:0px 0px 8pt 0px;}
  23.     h4 {margin-top: 0px;}
  24.     #byline { font-family: monospace; font-weight:bold; }
  25.     #placeline {font-weight:bold;}
  26.     #credit {margin-top:0px;}
  27.     .tag {font-size: 22pt;}'''
  28.     description = 'Canada\'s national newspaper'
  29.     keep_only_tags = [dict(name='article')]
  30.     remove_tags = [dict(name='aside'),
  31.                    dict(name='footer'),
  32.                    dict(name='div', attrs={'class':(lambda x: isinstance(x, (str,unicode)) and 'articlecommentcountholder' in x.split(' '))}),
  33.                    dict(name='ul', attrs={'class':(lambda x: isinstance(x, (str,unicode)) and 'articletoolbar' in x.split(' '))}),
  34.                   ]
  35.     feeds = [
  36.             (u'Latest headlines', u'http://www.theglobeandmail.com/?service=rss'),
  37.             (u'Top stories', u'http://www.theglobeandmail.com/?service=rss&feed=topstories'),
  38.             (u'National', u'http://www.theglobeandmail.com/news/national/?service=rss'),
  39.             (u'Politics', u'http://www.theglobeandmail.com/news/politics/?service=rss'),
  40.             (u'World', u'http://www.theglobeandmail.com/news/world/?service=rss'),
  41.             (u'Business', u'http://www.theglobeandmail.com/report-on-business/?service=rss'),
  42.             (u'Opinions', u'http://www.theglobeandmail.com/news/opinions/?service=rss'),
  43.             (u'Columnists', u'http://www.theglobeandmail.com/news/opinions/columnists/?service=rss'),
  44.             (u'Globe Investor', u'http://www.theglobeandmail.com/globe-investor/?service=rss'),
  45.             (u'Sports', u'http://www.theglobeandmail.com/sports/?service=rss'),
  46.             (u'Technology', u'http://www.theglobeandmail.com/news/technology/?service=rss'),
  47.             (u'Arts', u'http://www.theglobeandmail.com/news/arts/?service=rss'),
  48.             (u'Life', u'http://www.theglobeandmail.com/life/?service=rss'),
  49.             (u'Blogs', u'http://www.theglobeandmail.com/blogs/?service=rss'),
  50.             (u'Real Estate', u'http://www.theglobeandmail.com/real-estate/?service=rss'),
  51.             (u'Auto', u'http://www.theglobeandmail.com/auto/?service=rss')
  52.             ]
  53.  
  54.     def get_article_url(self, article):
  55.         url = BasicNewsRecipe.get_article_url(self, article)
  56.         if '/video/' not in url:
  57.             return url
  58.  
  59.