Update The Philosopher's Magazine

Fixes #1495383 [Fetch News: The Philosopers' Magazine doesn't download](https://bugs.launchpad.net/calibre/+bug/1495383)
This commit is contained in:
Kovid Goyal 2015-09-30 08:09:44 +05:30
parent 002ccf8d62
commit 96d3145ca5

View File

@ -1,7 +1,7 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
__copyright__ = '2010-2015, Darko Miletic <darko.miletic at gmail.com>'
'''
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