From 23929a62ccfb3d7f433c5cee55ad81b23e3b2019 Mon Sep 17 00:00:00 2001 From: DreckSoft <68750712+DreckSoft@users.noreply.github.com> Date: Sun, 27 Apr 2025 14:21:40 +0200 Subject: [PATCH] fix: logon detection and duplicate suffix in ad description (#488) Co-authored-by: Sebastian Thomschke --- src/kleinanzeigen_bot/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kleinanzeigen_bot/__init__.py b/src/kleinanzeigen_bot/__init__.py index 77c9ef6..9f0e553 100644 --- a/src/kleinanzeigen_bot/__init__.py +++ b/src/kleinanzeigen_bot/__init__.py @@ -391,12 +391,12 @@ class KleinanzeigenBot(WebScrapingMixin): continue # Get description with prefix/suffix from ad config if present, otherwise use defaults - ad_cfg["description"] = self.__get_description_with_affixes(ad_cfg) + description = self.__get_description_with_affixes(ad_cfg) # Validate total length - ensure(len(ad_cfg["description"]) <= 4000, - f"""Length of ad description including prefix and suffix exceeds 4000 chars. Description length: { - len(ad_cfg["description"])} chars. @ {ad_file}.""") + ensure(len(description) <= 4000, + f"Length of ad description including prefix and suffix exceeds 4000 chars. " + f"Description length: {len(description)} chars. @ {ad_file}.") # pylint: disable=cell-var-from-loop def assert_one_of(path:str, allowed:Iterable[str]) -> None: @@ -551,7 +551,7 @@ class KleinanzeigenBot(WebScrapingMixin): async def is_logged_in(self) -> bool: try: - user_info = await self.web_text(By.ID, "user-email") + user_info = await self.web_text(By.CLASS_NAME, "mr-medium") if self.config['login']['username'].lower() in user_info.lower(): return True except TimeoutError: