Parfois le alt manque
This commit is contained in:
parent
7c9cb1f550
commit
8b8c30d1b7
@ -54,7 +54,10 @@ class CExtractor(TwoStepsExtractorNoPause):
|
||||
soup = BeautifulSoup(html, "html.parser")
|
||||
title = soup.select_one("h2.widgit_title").text.strip()
|
||||
image = soup.select_one("img")
|
||||
image_alt = image["alt"]
|
||||
if image.has_attr("alt"):
|
||||
image_alt = image["alt"]
|
||||
else:
|
||||
image_alt = ""
|
||||
image = image["src"]
|
||||
description = soup.select("div.desc")
|
||||
description = "\n".join([d.text for d in description])
|
||||
|
Loading…
x
Reference in New Issue
Block a user