From 69ec0e1ee56699429b4b5ee4b9cb2bddccaec070 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 23 Mar 2010 11:36:00 +0530 Subject: [PATCH] ... --- resources/recipes/ieeespectrum.recipe | 12 ++++-------- src/calibre/web/feeds/news.py | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/resources/recipes/ieeespectrum.recipe b/resources/recipes/ieeespectrum.recipe index 79a107cd9d..e2490b2a6c 100644 --- a/resources/recipes/ieeespectrum.recipe +++ b/resources/recipes/ieeespectrum.recipe @@ -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]) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index d07c135abd..496a1f4d5b 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -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: