From 96d3145ca51d6095c75574e765c4de52b81bf197 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Sep 2015 08:09:44 +0530 Subject: [PATCH] Update The Philosopher's Magazine Fixes #1495383 [Fetch News: The Philosopers' Magazine doesn't download](https://bugs.launchpad.net/calibre/+bug/1495383) --- recipes/tpm_uk.recipe | 50 +++++++------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/recipes/tpm_uk.recipe b/recipes/tpm_uk.recipe index 0ccad32fa9..ae4ff37ba1 100644 --- a/recipes/tpm_uk.recipe +++ b/recipes/tpm_uk.recipe @@ -1,7 +1,7 @@ __license__ = 'GPL v3' -__copyright__ = '2010, Darko Miletic ' +__copyright__ = '2010-2015, Darko Miletic ' ''' -www.philosophypress.co.uk +www.philosophersmag.com ''' from calibre.web.feeds.news import BasicNewsRecipe @@ -11,10 +11,8 @@ class TPM_uk(BasicNewsRecipe): __author__ = 'Darko Miletic' description = 'Title says it all' publisher = "The Philosophers' Magazine" - recipe_disabled = ('This recipe has been disabled as the website has' - ' started providing articles only in PDF form') category = 'philosophy, news' - oldest_article = 25 + oldest_article = 80 max_articles_per_feed = 200 no_stylesheets = True encoding = 'utf8' @@ -22,10 +20,8 @@ class TPM_uk(BasicNewsRecipe): language = 'en_GB' remove_empty_feeds = True publication_type = 'magazine' - masthead_url = 'http://www.philosophypress.co.uk/wp-content/themes/masterplan/tma/images/bg/sitelogo.png' extra_css = """ - body{font-family: Helvetica,Arial,"Lucida Grande",Verdana,sans-serif } - img{margin-bottom: 0.4em; display:block} + body{font-family: Raleway,sans-serif } """ conversion_options = { @@ -35,40 +31,10 @@ class TPM_uk(BasicNewsRecipe): , 'language' : language } - remove_tags = [ - dict(name=['meta','link','base','iframe','embed','object','img']) - ,dict(attrs={'id':['respond','sharethis_0']}) - ,dict(attrs={'class':'wp-caption-text'}) - ] - keep_only_tags=[ - dict(attrs={'class':['post_cat','post_name','post_meta','post_text']}) - ,dict(attrs={'id':'comments'}) - ] - remove_attributes=['lang','width','height'] - + remove_tags = [dict(name=['meta','link','base','iframe','embed','object','img'])] + keep_only_tags = [dict(attrs={'class':['article-title','article-content']})] feeds = [ - (u'Columns' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=15' ) - ,(u'Essays' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=19' ) - ,(u"21'st Century" , u'http://www.philosophypress.co.uk/?feed=rss2&cat=101') - ,(u'Interviews' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=9' ) - ,(u'News' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=28' ) - ,(u'Profiles' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=59' ) - ,(u'Reviews' , u'http://www.philosophypress.co.uk/?feed=rss2&cat=12' ) + (u'Articles' , u'http://www.philosophersmag.com/index.php/tpm-mag-articles?format=feed&type=rss') + ,(u'Reflections', u'http://www.philosophersmag.com/index.php/reflections?format=feed&type=rss' ) ] - - def get_cover_url(self): - soup = self.index_to_soup('http://www.philosophypress.co.uk/') - for image in soup.findAll('img',title=True): - if image['title'].startswith('Click to Subscribe'): - return image['src'] - return None - - def preprocess_html(self, soup): - for item in soup.findAll(style=True): - del item['style'] - for alink in soup.findAll('a', rel=True): - if alink.string is not None: - tstr = alink.string - alink.replaceWith(tstr) - return soup