mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
fdaed4a169
commit
69ec0e1ee5
@ -29,16 +29,12 @@ class IEEESpectrum(BasicNewsRecipe):
|
||||
keep_only_tags = [dict(attrs={'class': {'artSctn':True, 'artTitle':True, 'dekTitle': True}}), dict(attrs={'id':'artBody'})]
|
||||
|
||||
|
||||
# def get_cover_url(self):
|
||||
# cover_url = None
|
||||
# soup = self.index_to_soup(self.index)
|
||||
# cover_item = soup.find('img',attrs={'image':'cover.gif'})
|
||||
# if cover_item:
|
||||
# cover_url = urljoin(self.index, cover_item['src'])
|
||||
# return cover_url
|
||||
|
||||
def parse_index(self):
|
||||
soup = self.index_to_soup(self.index)
|
||||
img = soup.find('img', image='cover.gif', src=True)
|
||||
if img is not None:
|
||||
self.cover_url = 'http://spectrum.ieee.org'+img['src']
|
||||
|
||||
content = soup.find(id='gnrlContent')
|
||||
title = content.find(attrs={'class':'style4'}).string.strip()
|
||||
date = ' '.join(title.split()[0:2])
|
||||
|
@ -864,10 +864,10 @@ class BasicNewsRecipe(Recipe):
|
||||
self.log.error(_('Could not download cover: %s')%str(err))
|
||||
self.log.debug(traceback.format_exc())
|
||||
if cu is not None:
|
||||
ext = cu.rpartition('.')[-1]
|
||||
ext = cu.split('/')[-1].rpartition('.')[-1]
|
||||
if '?' in ext:
|
||||
ext = ''
|
||||
ext = ext.lower() if ext else 'jpg'
|
||||
ext = ext.lower() if ext and '/' not in ext else 'jpg'
|
||||
cpath = os.path.join(self.output_dir, 'cover.'+ext)
|
||||
if os.access(cu, os.R_OK):
|
||||
with open(cpath, 'wb') as cfile:
|
||||
|
Loading…
x
Reference in New Issue
Block a user