View Single Post
Old 07-29-2011, 09:49 AM   #11
technicaltitch
Member
technicaltitch began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Jul 2011
Device: Sony PRS 350
Excuse the noob here, but I can't get either the 0.8.11 version or the baron's version working - I get "Has your subscription expired?" with both since the Economist changed format this week. (Perhaps they have different formats or rules for different countries? I assume an upgrade install will replace the built in recipes with the new versions.)

In case anyone else is getting this issue, and they are as clueless as me with python, soup, etc, I have found that replacing parse_index (and economist_parse_index) with the following works. It is horrendous code and should be deleted asap, and is the stuff of nightmares for Kovid - I've cut every corner I can and barely understand it, but it gets the article text from the new website into my PRS until someone cleverer looks at it.

PHP Code:
    def parse_index(self):
        
articles = []
        
soup self.index_to_soup(self.INDEX)
        
cover None
        feeds 
= []
        for 
section in soup.findAll('div'attrs={'class':'article'}):
            
section_title 'section title'
            
articles = []
            for 
post in section.findAll('a'href=True):
                
url post['href']
                if 
url.startswith('/'):
                  
url 'http://www.economist.com'+url
                  title 
self.tag_to_string(post)
                  
articles.append({'title':title'url':url})
            if 
articles:
                
feeds.append((section_titlearticles))
        return 
feeds 
If this doesn't work for some people, perhaps the Economist needs two recipes.

HUGE thanks for oneillpt for this brilliant post:
https://www.mobileread.com/forums/sho...71&postcount=3

And this thread:
https://www.mobileread.com/forums/arc.../t-121643.html
technicaltitch is offline   Reply With Quote