View Single Post
Old 11-22-2008, 10:25 AM   #2
kiklop74
Guru
kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.
 
kiklop74's Avatar
 
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
Quote:
Originally Posted by mccande View Post
This is a great program.

My early attempts at writing recipes in Python were not a great success.

Could anyone help with a recipe for the following publications

http://www.timesonline.co.uk/tol/news/
Here goes:

Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
timesonline.co.uk
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Timesonline(BasicNewsRecipe):
    title                 = u'The Times Online'
    __author__            = 'Darko Miletic'
    description           = 'UK news'    
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    simultaneous_downloads = 1

    remove_tags_after  = dict(name='div', attrs={'class':'bg-666'})
    remove_tags = [
                     dict(name='div'  , attrs={'class':'hide-from-print padding-bottom-7' })
                  ]

    feeds          = [
                        (u'Top stories from Times Online', u'http://www.timesonline.co.uk/tol/feeds/rss/topstories.xml'     )
                     ]

    def print_version(self, url):
        main, split, rest = url.partition('#')
        return main + '?print=yes'

Quote:
Originally Posted by mccande View Post
Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
thescotsman.scotsman.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Thescotsman(BasicNewsRecipe):
    title                 = u'The Scotsman'
    __author__            = 'Darko Miletic'
    description           = 'News from Scotland'    
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    simultaneous_downloads = 1

    keep_only_tags = [dict(name='div', attrs={'id':'viewarticle'})]
    remove_tags = [
                     dict(name='div'  , attrs={'class':'viewarticlepanel' })
                  ]

    feeds          = [
                        (u'Latest National News', u'http://thescotsman.scotsman.com/getFeed.aspx?Format=rss&sectionid=4068')
                     ]
kiklop74 is offline   Reply With Quote