View Single Post
Old 12-20-2008, 10:35 PM   #68
ddavtian
Addict
ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.ddavtian has a complete set of Star Wars action figures.
 
Posts: 278
Karma: 332
Join Date: Nov 2003
Location: San Francisco, USA
Device: Boox Air 5C, Sage, Elipsa 2E, Oasis, Galaxy Tab 11U, Fold7, Xteink
Hi guys.

I wrote this simple code for Forbes. It works, could use better cleaning of the text. There is even a low resolution cover page :-) But it doesn't create the menu items for articles: Next, Previous, Main, etc.

If somebody can improve this, please post back.

Thanks, David

PHP Code:
class AdvancedUserRecipe1226018223(BasicNewsRecipe):
    
title          = u'Forbes'
    
oldest_article = 30
    max_articles_per_feed 
= 100
    no_stylesheets 
= True
    html2lrf_options 
= ['--base-font-size', '10']     

    
    
remove_tags_before  = dict(id='p_RightTop')
    
remove_tags_after  = dict(id='contextualLinks')
    
remove_tags = [dict(id=['controlsbox', 'sharePanel']),
           ]
    
feeds          = [(u'Latest', u'http://www.forbes.com/news/index.xml'), 
        (
u'Most Popular', u'http://www.forbes.com/feeds/popstories.xml'), 
        (
u'Most Emailed', u'http://www.forbes.com/feeds/mostemailed.xml'), 
        (
u'Faces', u'http://www.forbes.com/facesscan/index.xml'), 
        (
u'Technology', u'http://www.forbes.com/technology/index.xml'), 
        (
u'Personal Tech', u'http://www.forbes.com/personaltech/index.xml'), 
        (
u'Wireless', u'http://www.forbes.com/wireless/index.xml'),
        (
u'Business', u'http://www.forbes.com/business/index.xml'), 
        (
u'Sports Money', u'http://www.forbes.com/sportsmoney/index.xml'), 
        (
u'Sports', u'http://www.forbes.com/forbeslife/sports/index.xml'),
        (
u'Vehicles', u'http://www.forbes.com/forbeslife/vehicles/index.xml'),
        (
u'Leadership', u'http://www.forbes.com/leadership/index.xml'), 
        (
u'Careers', u'http://www.forbes.com/leadership/careers/index.xml'),
        (
u'Compensation', u'http://www.forbes.com/leadership/compensation/index.xml'),
        (
u'Managing', u'http://www.forbes.com/leadership/managing/index.xml')]


    
def get_cover_url(self):
        
self.cover_url  = u'http://www.forbes.com/media/current_covers/forbes_120_160.gif'
        
cover =  self.cover_url
        
return cover 
ddavtian is offline