mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
Fixes broken --ads parameter (#249)
This commit is contained in:
@@ -238,8 +238,10 @@ class KleinanzeigenBot(SeleniumMixin):
|
||||
descr_suffix = self.config["ad_defaults"]["description"]["suffix"] or ""
|
||||
|
||||
ids = []
|
||||
use_specific_ads = False
|
||||
if re.compile(r'\d+[,\d+]*').search(self.ads_selector):
|
||||
ids = [int(n) for n in self.ads_selector.split(',')]
|
||||
use_specific_ads = True
|
||||
LOG.info('Start fetch task for the ad(s) with the id(s):')
|
||||
LOG.info(' | '.join([str(id_) for id_ in ids]))
|
||||
|
||||
@@ -256,6 +258,11 @@ class KleinanzeigenBot(SeleniumMixin):
|
||||
LOG.info(" -> SKIPPED: inactive ad [%s]", ad_file)
|
||||
continue
|
||||
|
||||
if use_specific_ads:
|
||||
if not ad_cfg["id"] in ids:
|
||||
LOG.info(" -> SKIPPED: ad [%s] is not in list of given ids.", ad_file)
|
||||
continue
|
||||
else:
|
||||
if self.ads_selector == "new" and ad_cfg["id"] and check_id:
|
||||
LOG.info(" -> SKIPPED: ad [%s] is not new. already has an id assigned.", ad_file)
|
||||
continue
|
||||
@@ -278,10 +285,6 @@ class KleinanzeigenBot(SeleniumMixin):
|
||||
)
|
||||
continue
|
||||
|
||||
if not ad_cfg["id"] in ids:
|
||||
LOG.info(" -> SKIPPED: ad [%s] is not in list of given ids.", ad_file)
|
||||
continue
|
||||
|
||||
ad_cfg["description"] = descr_prefix + (ad_cfg["description"] or "") + descr_suffix
|
||||
ensure(len(ad_cfg["description"]) <= 4000, f"Length of ad description including prefix and suffix exceeds 4000 chars. @ [{ad_file}]")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user