mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
fix: logon detection and duplicate suffix in ad description (#488)
Co-authored-by: Sebastian Thomschke <sebthom@users.noreply.github.com>
This commit is contained in:
@@ -391,12 +391,12 @@ class KleinanzeigenBot(WebScrapingMixin):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Get description with prefix/suffix from ad config if present, otherwise use defaults
|
# 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
|
# Validate total length
|
||||||
ensure(len(ad_cfg["description"]) <= 4000,
|
ensure(len(description) <= 4000,
|
||||||
f"""Length of ad description including prefix and suffix exceeds 4000 chars. Description length: {
|
f"Length of ad description including prefix and suffix exceeds 4000 chars. "
|
||||||
len(ad_cfg["description"])} chars. @ {ad_file}.""")
|
f"Description length: {len(description)} chars. @ {ad_file}.")
|
||||||
|
|
||||||
# pylint: disable=cell-var-from-loop
|
# pylint: disable=cell-var-from-loop
|
||||||
def assert_one_of(path:str, allowed:Iterable[str]) -> None:
|
def assert_one_of(path:str, allowed:Iterable[str]) -> None:
|
||||||
@@ -551,7 +551,7 @@ class KleinanzeigenBot(WebScrapingMixin):
|
|||||||
|
|
||||||
async def is_logged_in(self) -> bool:
|
async def is_logged_in(self) -> bool:
|
||||||
try:
|
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():
|
if self.config['login']['username'].lower() in user_info.lower():
|
||||||
return True
|
return True
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
|
|||||||
Reference in New Issue
Block a user