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

  1. #!/usr/bin/env  python
  2. __license__   = 'GPL v3'
  3. __author__    = 'Lorenzo Vigentini'
  4. __copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
  5. description   = 'News from the Orange county - v1.01 (29, January 2010)'
  6.  
  7. '''
  8. http://www.ocregister.com/
  9. '''
  10.  
  11. from calibre.web.feeds.news import BasicNewsRecipe
  12.  
  13. class ocRegister(BasicNewsRecipe):
  14.     author        = 'Lorenzo Vigentini'
  15.     description   = 'News from the Orange county'
  16.  
  17.     cover_url      = 'http://images.onset.freedom.com/ocregister/logo.gif'
  18.     title          = u'Orange County Register'
  19.     publisher      = 'Orange County Register Communication'
  20.     category       = 'News, finance, economy, politics'
  21.  
  22.     language       = 'en'
  23.     timefmt        = '[%a, %d %b, %Y]'
  24.  
  25.     oldest_article = 1
  26.     max_articles_per_feed = 25
  27.     use_embedded_content  = False
  28.     recursion             = 10
  29.  
  30.     remove_javascript     = True
  31.     no_stylesheets        = True
  32.  
  33.     def print_version(self,url):
  34.         printUrl    = 'http://www.ocregister.com/common/printer/view.php?db=ocregister&id='
  35.         segments = url.split('/')
  36.         subSegments = (segments[4]).split('.')
  37.         myArticle = (subSegments[0]).replace('-', '')
  38.         myURL= printUrl + myArticle
  39.         return myURL
  40.  
  41.     keep_only_tags     = [
  42.                             dict(name='div', attrs={'id':'ArticleContentWrap'})
  43.                         ]
  44.  
  45.     remove_tags = [
  46.                      dict(name='div', attrs={'class':'hideForPrint'}),
  47.                      dict(name='div', attrs={'id':'ContentFooter'})
  48.                   ]
  49.  
  50.     feeds          = [
  51.                        (u'News', u'http://www.ocregister.com/common/rss/rss.php?catID=18800'),
  52.                        (u'Today paper', u'http://www.ocregister.com/common/rss/rss.php?catID=18976'),
  53.                        (u'Business', u'http://www.ocregister.com/common/rss/rss.php?catID=18909'),
  54.                        (u'Cars', u'http://www.ocregister.com/common/rss/rss.php?catID=20128'),
  55.                        (u'Entertainment', u'http://www.ocregister.com/common/rss/rss.php?catID=18926'),
  56.                        (u'Home', u'http://www.ocregister.com/common/rss/rss.php?catID=19142'),
  57.                        (u'Life', u'http://www.ocregister.com/common/rss/rss.php?catID=18936'),
  58.                        (u'Opinion', u'http://www.ocregister.com/common/rss/rss.php?catID=18963'),
  59.                        (u'Sports', u'http://www.ocregister.com/common/rss/rss.php?catID=18901'),
  60.                        (u'Travel', u'http://www.ocregister.com/common/rss/rss.php?catID=18959')
  61.                      ]
  62.  
  63.     extra_css = '''
  64.                 h1 {color:#ff6600;font-family:Arial,Helvetica,sans-serif; font-size:20px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:20px;}
  65.                 h2 {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif; font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:16px; }
  66.                 h3 {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif; font-size:15px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:15px;}
  67.                 h4 {color:#333333; font-family:Arial,Helvetica,sans-serif;font-size:13px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:13px; }
  68.                 h5 {color:#333333; font-family:Arial,Helvetica,sans-serif; font-size:11px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:11px; text-transform:uppercase;}
  69.                 #articledate {color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:italic; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  70.                 #articlebyline {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  71.                 img {align:left;}
  72.                 #topstoryhead {color:#ff6600;font-family:Arial,Helvetica,sans-serif; font-size:22px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:20px;}
  73.                 '''
  74.