From a3bbb4f212bcda180e5646a2317248bc4f039690 Mon Sep 17 00:00:00 2001 From: Joan Cano Date: Thu, 2 Mar 2023 13:15:11 +0100 Subject: [PATCH] =?UTF-8?q?Ahora=20s=C3=AD,=20arreglado=20y=20comprobado!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wallamanta/worker.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wallamanta/worker.py b/wallamanta/worker.py index c2e4f3b..6af7653 100644 --- a/wallamanta/worker.py +++ b/wallamanta/worker.py @@ -73,15 +73,14 @@ class Worker: for article in articles: if not article['id'] in list: logging.info(f"Found article {article['title']}") - logging.info(f"Description (parsed): {helpers.telegram_escape_characters(article['description'])}") try: if not self.has_excluded_words(article['title'].lower(), article['description'].lower(), product['exclude']) and not self.is_title_key_word_excluded(article['title'].lower(), product['title_keyword_exclude']): try: - text = f"*Artículo*: {helpers.telegram_escape_characters(article['title'])}\n*Descripción*: {helpers.telegram_escape_characters(article['description'])}\n*Precio*: {helpers.telegram_escape_characters(article['price'])} {helpers.telegram_escape_characters(article['currency'])}\n[Ir al anuncio](https://es\.wallapop\.com/item/{helpers.telegram_escape_characters(article['web_slug'])})" + text = f"*Artículo*: {helpers.telegram_escape_characters(article['title'])}\n*Descripción*: {helpers.telegram_escape_characters(article['description'])}\n*Precio*: {helpers.telegram_escape_characters(str(article['price']))} {helpers.telegram_escape_characters(article['currency'])}\n[Ir al anuncio](https://es\.wallapop\.com/item/{helpers.telegram_escape_characters(article['web_slug'])})" url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage?chat_id={TELEGRAM_CHANNEL_ID}&text={text}&parse_mode=MarkdownV2" logging.info(requests.get(url).json()) except: - text = f"*Artículo*: {helpers.telegram_escape_characters(article['title'])}\n*Descripción*: {helpers.telegram_escape_characters(article['description'])}\n*Precio*: {helpers.telegram_escape_characters(article['price'])} {helpers.telegram_escape_characters(article['currency'])}\n[Ir al anuncio](https://es\.wallapop\.com/item/{helpers.telegram_escape_characters(article['web_slug'])})" + text = f"*Artículo*: {helpers.telegram_escape_characters(article['title'])}\n*Descripción*: {helpers.telegram_escape_characters(article['description'])}\n*Precio*: {helpers.telegram_escape_characters(str(article['price']))} {helpers.telegram_escape_characters(article['currency'])}\n[Ir al anuncio](https://es\.wallapop\.com/item/{helpers.telegram_escape_characters(article['web_slug'])})" url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage?chat_id={TELEGRAM_CHANNEL_ID}&text={text}&parse_mode=MarkdownV2" logging.info(requests.get(url).json()) time.sleep(1) # Avoid Telegram flood restriction