View Single Post
Old 01-31-2012, 02:01 AM   #5
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Here is the final recipe. Let me know if something isn't working or you have questions.

Spoiler:
Code:
# -*- coding: utf-8 -*-
__license__   = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>, Armin Geller'

'''
Fetch High Country News
'''
from calibre.web.feeds.news import BasicNewsRecipe
class HighCountryNews(BasicNewsRecipe):

    title                 = u'High Country News'
    description           = u'High Country News (RSS Version)'
    __author__            = 'Armin Geller' # 2012-01-31
    publisher             = 'High Country News'
    category              = 'news, politics, Germany'
    timefmt               = ' [%a, %d %b %Y]'
    language              = 'en-Us'
    encoding              = 'UTF-8'
    publication_type      = 'newspaper'
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True 
    auto_cleanup          = True
    remove_javascript     = True
    use_embedded_content  = False  
    masthead_url          = 'http://www.hcn.org/logo.jpg' # 2012-01-31 AGe add
    cover_source          = 'http://www.hcn.org'          # 2012-01-31 AGe add
    
    def get_cover_url(self):                              # 2012-01-31 AGe add
       cover_source_soup = self.index_to_soup(self.cover_source)
       preview_image_div = cover_source_soup.find(attrs={'class':' portaltype-Plone Site content--hcn template-homepage_view'})
       return preview_image_div.div.img['src']
    
    feeds = [
              (u'Most recent', u'http://feeds.feedburner.com/hcn/most-recent'),
              (u'Current Issue', u'http://feeds.feedburner.com/hcn/current-issue'),

              (u'Writers on the Range', u'http://feeds.feedburner.com/hcn/wotr'),
              (u'High Country Views', u'http://feeds.feedburner.com/hcn/HighCountryViews'),
             ]
 
    def print_version(self, url):
          return url + '/print_view'
Attached Files
File Type: zip HighCountryNews_AGeV1.0.zip (925 Bytes, 192 views)
Divingduck is offline   Reply With Quote