Dear Kovid,
thanks for your quick reply. - However, as it appears, I still dont't get it right.
I took your snippet and made from it this:
Code:
cover_source = 'https://kaufhaus.handelsblatt.com/downloads/wirtschaftswoche-emagazin-p1952.html'
def get_cover_url(self):
cover_source_soup = self.index_to_soup(self.cover_source)
style = soup.find('img', alt='WirtschaftsWoche eMagazin', style=True)['style']
self.cover_url = style.partition('(')[-1].rpartition(')')[0]
return self.cover_url
But when I look into the log of the recipe I get:
Quote:
[Cover could not be downloaded]: global name 'soup' is not defined
Traceback (most recent call last):
File "site-packages/calibre/web/feeds/news.py", line 1263, in _download_cover
File "<string>", line 49, in get_cover_url
NameError: global name 'soup' is not defined
|
Line 49 is your "style = soup.find ... "line.
As far as my limited understanding of these issues goes, I have to embedd this code somehow into an "def ... return ..." section. But maybe your suggestion was meant in a different way?
Thanks again.
Hegi.