From 27e5f2c94a00bf453fed7700e3302c2ef70d0c65 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 3 Aug 2013 13:37:10 +0530 Subject: [PATCH] Private Eye by Martyn Pritchard --- recipes/private_eye.recipe | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 recipes/private_eye.recipe diff --git a/recipes/private_eye.recipe b/recipes/private_eye.recipe new file mode 100644 index 0000000000..265812125d --- /dev/null +++ b/recipes/private_eye.recipe @@ -0,0 +1,31 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1359406781(BasicNewsRecipe): + title = u'Private Eye' + oldest_article = 15 + max_articles_per_feed = 100 + remove_empty_feeds = True + remove_javascript = True + no_stylesheets = True + ignore_duplicate_articles = {'title'} + language = 'en_GB' + __author__ = 'Martyn Pritchard' + encoding = 'iso-8859-1' + compress_news_images = True + compress_news_images_auto_size = 8 + scale_news_images_to_device = False + scale_news_images = (220, 300) + + def get_cover_url(self): + soup = self.index_to_soup('http://www.private-eye.co.uk') + cov = soup.find(attrs={'width' : '180', 'border' : '0'}) + cover_url = 'http://www.private-eye.co.uk/'+cov['src'] + return cover_url + + keep_only_tags = [dict(name='table', attrs={'width':['100%'], 'border':['0'], 'align': ['center'], 'cellspacing':['0'], 'cellpadding':['0']}), + dict(name='table', attrs={'width':['480'], 'cellspacing':['0'], 'cellpadding':['0']}), + dict(name='table', attrs={'width':['490'], 'border':['0'], 'align': ['left'], 'cellspacing':['0'], 'cellpadding':['1']}), + dict(name='table', attrs={'width':['500'], 'cellspacing':['0'], 'cellpadding':['0']}), + ] + + feeds = [(u'Private Eye', u'http://www.private-eye.co.uk/rss/rss.php')]