Skip to content

Commit

Permalink
fix: save location #296
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Nov 21, 2024
1 parent 86c3aee commit 735e564
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/kleinanzeigen_bot/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ async def _extract_contact_from_ad_page(self) -> dict[str, (str | None)]:
contact['street'] = street
except TimeoutError:
LOG.info('No street given in the contact.')
# construct remaining address
address_halves = address_text.split(' - ')
address_left_parts = address_halves[0].split(' ') # zip code and region/city
contact['zipcode'] = address_left_parts[0]

(zipcode, location) = address_text.split(" ", 1)
contact['zipcode'] = zipcode # e.g. 19372
contact['location'] = location # e.g. Mecklenburg-Vorpommern - Steinbeck

contact_person_element:Element = await self.web_find(By.ID, 'viewad-contact')
name_element = await self.web_find(By.CLASS_NAME, 'iconlist-text', parent = contact_person_element)
Expand Down

0 comments on commit 735e564

Please sign in to comment.