mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update More Intelligent Life
Fixes #1529648 [Updated recipe for Intelligent life magazine](https://bugs.launchpad.net/calibre/+bug/1529648)
This commit is contained in:
parent
c33017583e
commit
4325742a35
@ -1,5 +1,5 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Darko Miletic <darko.miletic at gmail.com>'
|
||||
__copyright__ = '2013 - 2015, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
moreintelligentlife.com
|
||||
'''
|
||||
@ -20,8 +20,9 @@ class MoreIntelligentLife(BasicNewsRecipe):
|
||||
language = 'en'
|
||||
remove_empty_feeds = True
|
||||
publication_type = 'website'
|
||||
auto_cleanup = True
|
||||
extra_css = """
|
||||
body{font-family: Arial,"Helvetica neue","Bitstream Vera Sans",sans-serif}
|
||||
body{font-family: "DTL Fleischmann-Regular", serif}
|
||||
img{margin-bottom: 0.4em; display:block}
|
||||
"""
|
||||
|
||||
@ -32,36 +33,4 @@ class MoreIntelligentLife(BasicNewsRecipe):
|
||||
, 'language' : language
|
||||
}
|
||||
|
||||
keep_only_tags = [dict(attrs={'class':'node'})]
|
||||
remove_tags_after = dict(attrs={'class':'tags'})
|
||||
remove_tags = [dict(name=['meta','link','iframe','embed','object'])]
|
||||
remove_attributes = ['lang']
|
||||
|
||||
feeds = [(u'Articles', u'http://feeds.feedburner.com/MoreintelligentlifeTotal')]
|
||||
|
||||
def get_cover_url(self):
|
||||
soup = self.index_to_soup('http://moreintelligentlife.com/')
|
||||
for image in soup.findAll('img', src=True):
|
||||
if image['src'].startswith('http://moreintelligentlife.com/files/covers/current_issue_'):
|
||||
return image['src']
|
||||
return None
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
for item in soup.findAll('a'):
|
||||
limg = item.find('img')
|
||||
if item.string is not None:
|
||||
str = item.string
|
||||
item.replaceWith(str)
|
||||
else:
|
||||
if limg:
|
||||
item.name = 'div'
|
||||
item.attrs = []
|
||||
else:
|
||||
str = self.tag_to_string(item)
|
||||
item.replaceWith(str)
|
||||
for item in soup.findAll('img'):
|
||||
if not item.has_key('alt'):
|
||||
item['alt'] = 'image'
|
||||
return soup
|
||||
feeds = [(u'Articles', u'http://www.intelligentlifemagazine.com/rss/content')]
|
||||
|
Loading…
x
Reference in New Issue
Block a user