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

  1. #!/usr/bin/env  python
  2. __license__   = 'GPL v3'
  3. __author__    = 'Tony Stegall'
  4. __copyright__ = '2010, Tony Stegall or Tonythebookworm on mobiread.com'
  5. __version__   = '1.03'
  6. __date__      = '27, September 2010'
  7. __docformat__ = 'restructuredtext en'
  8.  
  9.  
  10.  
  11. import datetime
  12. from calibre.web.feeds.news import BasicNewsRecipe
  13.  
  14. class AdvancedUserRecipe1282101454(BasicNewsRecipe):
  15.     now = datetime.datetime.now()
  16.     title = 'The AJC'
  17.     timefmt = ' [%a,%d %B %Y %I:%M %p]'
  18.     __author__ = 'TonytheBookworm'
  19.     language = 'en'
  20.     description = 'News from Atlanta and USA'
  21.     publisher = 'The Atlanta Journal'
  22.     category = 'news, politics, USA'
  23.     oldest_article = 1
  24.     max_articles_per_feed = 100
  25.     no_stylesheets = True
  26.  
  27.     masthead_url = 'http://gawand.org/wp-content/uploads/2010/06/ajc-logo.gif'
  28.     extra_css = '''
  29.                     h1.articleHeadline{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  30.                     h2.articleSubheadline{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
  31.  
  32.                     p.byline{text-align:right; font-size:small;margin-top:0px;margin-bottom: 0px;}
  33.                     p.organization{text-align:right; font-size:small;margin-top:0px;margin-bottom: 0px;}
  34.  
  35.  
  36.                     p{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  37.                 '''
  38.  
  39.  
  40.     keep_only_tags    = [
  41.                         dict(name='div', attrs={'class':['cxArticleHeader']})
  42.                        ,dict(attrs={'id':['cxArticleText']})
  43.                         ]
  44.  
  45.  
  46.     remove_tags = [
  47.                      dict(name='div'  , attrs={'class':'cxArticleList'       })
  48.                     ,dict(name='div'  , attrs={'class':'cxFeedTease' })
  49.                     ,dict(name='div'  , attrs={'class':'cxElementEnlarge'  })
  50.                     ,dict(name='div'  , attrs={'id':'cxArticleTools'  })
  51.                   ]
  52.  
  53.  
  54.  
  55.     feeds          = [
  56.                       ('Breaking News', 'http://www.ajc.com/genericList-rss.do?source=61499'),
  57.                       # -------------------------------------------------------------------
  58.                       # Here are the different area feeds. Choose which ever one you wish to
  59.                       # read by simply removing the pound sign from it.  I currently have it
  60.                       # set to only get the Cobb area
  61.                       # --------------------------------------------------------------------
  62.                       #('Atlanta & Fulton', 'http://www.ajc.com/section-rss.do?source=atlanta'),
  63.                       #('Clayton', 'http://www.ajc.com/section-rss.do?source=clayton'),
  64.                       #('DeKalb', 'http://www.ajc.com/section-rss.do?source=dekalb'),
  65.                       #('Gwinnett', 'http://www.ajc.com/section-rss.do?source=gwinnett'),
  66.                       #('North Fulton', 'http://www.ajc.com/section-rss.do?source=north-fulton'),
  67.                       #('Metro', 'http://www.ajc.com/section-rss.do?source=news'),
  68.                       #('Cherokee', 'http://www.ajc.com/section-rss.do?source=cherokee'),
  69.                        ('Cobb', 'http://www.ajc.com/section-rss.do?source=cobb'),
  70.                       #('Fayette', 'http://www.ajc.com/section-rss.do?source=fayette'),
  71.                       #('Henry', 'http://www.ajc.com/section-rss.do?source=henry'),
  72.                       #('Q & A', 'http://www.ajc.com/genericList-rss.do?source=77197'),
  73.                        ('Opinions', 'http://www.ajc.com/section-rss.do?source=opinion'),
  74.                        ('Ga Politics', 'http://www.ajc.com/section-rss.do?source=georgia-politics-elections'),
  75.                       # ------------------------------------------------------------------------
  76.                       # Here are the different sports feeds. I only follow the Falcons, and Highschool
  77.                       # but again
  78.                       # You can enable which ever team you like by removing the pound sign
  79.                       # ------------------------------------------------------------------------
  80.                       #('Sports News', 'http://www.ajc.com/genericList-rss.do?source=61510'),
  81.                       #('Braves', 'http://www.ajc.com/genericList-rss.do?source=61457'),
  82.                        ('Falcons', 'http://www.ajc.com/genericList-rss.do?source=61458'),
  83.                       #('Hawks', 'http://www.ajc.com/genericList-rss.do?source=61522'),
  84.                       #('Dawgs', 'http://www.ajc.com/genericList-rss.do?source=61492'),
  85.                       #('Yellowjackets', 'http://www.ajc.com/genericList-rss.do?source=61523'),
  86.                        ('Highschool', 'http://www.ajc.com/section-rss.do?source=high-school'),
  87.                        ('Events', 'http://www.accessatlanta.com/section-rss.do?source=events'),
  88.                        ('Music', 'http://www.accessatlanta.com/section-rss.do?source=music'),
  89.                     ]
  90.  
  91.  
  92.  
  93.     def postprocess_html(self, soup, first):
  94.       for credit_tag in soup.findAll('span', attrs={'class':['imageCredit rightFloat']}):
  95.        credit_tag.extract()
  96.  
  97.       return soup
  98.  
  99.    #def print_version(self, url):
  100.    #     return url.partition('?')[0] +'?printArticle=y'
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.