Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter errors for Immowelt crawler #647

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions flathunter/crawler/immowelt.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,22 @@ def extract_data(self, soup: BeautifulSoup):
for adv in advertisements:
try:
title = adv.find("div", {"class": "css-1cbj9xw"}).text
except:
except AttributeError:
title = ""

try:
price = adv.find(
"div", attrs={"data-testid": "cardmfe-price-testid"}).text
except:
except AttributeError:
price = ""

try:
descriptions = adv.find("div", attrs={"data-testid": "cardmfe-keyfacts-testid"}).children
descriptions = adv.find("div",
attrs={"data-testid": "cardmfe-keyfacts-testid"}).children
descriptions = [result.text for result in descriptions]
except:
except AttributeError:
descriptions = []

size = list(filter(lambda x: "m²" in x, descriptions))
try:
size = size[0]
Expand Down Expand Up @@ -122,4 +123,4 @@ def extract_data(self, soup: BeautifulSoup):
entries.append(details)

logger.debug('Number of entries found: %d', len(entries))
return entries
return entries
Loading