Added recipe for The Guardian

This commit is contained in:
Kovid Goyal 2008-10-07 17:49:34 -07:00
parent 323dfce595
commit 20f608294d
3 changed files with 44 additions and 2 deletions

View File

@ -479,7 +479,10 @@ class DynamicConfig(dict):
if os.path.exists(self.file_path):
with ExclusiveFile(self.file_path) as f:
raw = f.read()
try:
d = cPickle.loads(raw) if raw.strip() else {}
except:
d = {}
dict.__init__(self, d)
def __getitem__(self, key):

View File

@ -10,7 +10,7 @@ recipes = [
'wired', 'globe_and_mail', 'smh', 'espn', 'business_week',
'ars_technica', 'upi', 'new_yorker', 'irish_times', 'iht',
'discover_magazine', 'scientific_american', 'new_york_review_of_books',
'daily_telegraph',
'daily_telegraph', 'guardian',
]
import re, imp, inspect, time, os

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
www.guardian.co.uk
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Guardian(BasicNewsRecipe):
title = u'The Guardian'
__author__ = 'Seabound'
oldest_article = 7
max_articles_per_feed = 20
timefmt = ' [%a, %d %b %Y]'
remove_tags_before = dict(id='main-article-info')
remove_tags_after = dict(id='article-wrapper')
remove_tags_after = dict(id='content')
no_stylesheets = True
extra_css = 'h2 {font-size: medium;} \n h1 {text-align: left;}'
feeds = [
('Front Page', 'http://www.guardian.co.uk/rss'),
('Business', 'http://www.guardian.co.uk/business/rss'),
('Sport', 'http://www.guardian.co.uk/sport/rss'),
('Culture', 'http://www.guardian.co.uk/culture/rss'),
('Money', 'http://www.guardian.co.uk/money/rss'),
('Life & Style', 'http://www.guardian.co.uk/lifeandstyle/rss'),
('Travel', 'http://www.guardian.co.uk/travel/rss'),
('Environment', 'http://www.guardian.co.uk/environment/rss'),
('Comment','http://www.guardian.co.uk/commentisfree/rss'),
]