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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. sfgate.com
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10. import re
  11.  
  12. class SanFranciscoChronicle(BasicNewsRecipe):
  13.     title                 = u'San Francisco Chronicle'
  14.     __author__            = u'Darko Miletic and Sujata Raman'
  15.     description           = u'San Francisco news'
  16.     language = 'en'
  17.  
  18.     oldest_article        = 7
  19.     max_articles_per_feed = 100
  20.     no_stylesheets        = True
  21.     use_embedded_content  = False
  22.  
  23.  
  24.  
  25.     remove_tags_before  = {'id':'printheader'}
  26.  
  27.     remove_tags         = [
  28.                             dict(name='div',attrs={'id':'printheader'})
  29.                            ,dict(name='a', attrs={'href':re.compile('http://ads\.pheedo\.com.*')})
  30.                            ,dict(name='div',attrs={'id':'footer'})
  31.                           ]
  32.  
  33.     extra_css       = '''
  34.                         h1{font-family :Arial,Helvetica,sans-serif; font-size:large;}
  35.                         h2{font-family :Arial,Helvetica,sans-serif; font-size:medium; color:#666666;}
  36.                         h3{font-family :Arial,Helvetica,sans-serif; font-size:medium; color:#000000;}
  37.                         h4{font-family :Arial,Helvetica,sans-serif; font-size: x-small;}
  38.                         p{font-family :Arial,Helvetica,sans-serif; font-size:x-small;}
  39.                         .byline{font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
  40.                         .date{font-family :Arial,Helvetica,sans-serif; font-size: xx-small;}
  41.                         .dtlcomment{font-style:italic;}
  42.                         .georgia h3{font-family :Arial,Helvetica,sans-serif; font-size:x-small; color:#000000;}
  43.                      '''
  44.  
  45.     feeds          = [
  46.                          (u'Top News Stories', u'http://www.sfgate.com/rss/feeds/news.xml')
  47.                      ]
  48.  
  49.     def print_version(self,url):
  50.         url= url +"&type=printable"
  51.         return url
  52.  
  53.     def get_article_url(self, article):
  54.         print str(article['title_detail']['value'])
  55.         url = article.get('guid',None)
  56.         url = "http://www.sfgate.com/cgi-bin/article.cgi?f="+url
  57.         if "Presented By:" in str(article['title_detail']['value']):
  58.             url = ''
  59.         return url
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.