Quote:
Originally Posted by mccande
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
|
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§ionid=4068')
]