From 473e160f1df08847663aad6d9d3c667552d0f8a7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 16 Sep 2021 17:27:22 +0300 Subject: fixes --- binance-announcements-scraping-bot.py | 12 +++++++----- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/binance-announcements-scraping-bot.py b/binance-announcements-scraping-bot.py index ad57314..7809470 100755 --- a/binance-announcements-scraping-bot.py +++ b/binance-announcements-scraping-bot.py @@ -29,9 +29,12 @@ def scrap_announcements(): if not link.get('id').startswith('supportList'): continue + href = link.get('href') + if href.startswith('/'): + href = f'https://www.binance.com{href}' category_data['news'].append({ 'text': link.text, - 'link': link.get('href') + 'link': href }) total_news += 1 @@ -56,15 +59,14 @@ if __name__ == '__main__': state['urls'].append(item['link']) if updates: - buf = f"{category['title']}\n" - buf += '\n'.join(list(map(lambda item: f"{item['text']}", updates))) + buf = f"{category['title']}\n" + buf += '\n'.join(list(map(lambda item: f"{item['text']}", updates))) blocks.append(buf) if blocks: message = 'Binance Announcements\n\n' message += '\n\n'.join(blocks) - - telegram_notify(text=message, parse_mode='HTML') + telegram_notify(text=message, parse_mode='HTML', disable_web_page_preview=True) except: telegram_notify(text='error: ' + escape(traceback.format_exc()), parse_mode='HTML') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e2b8800..d9826d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests~=2.26.0 beautifulsoup4~=4.10.0 -ch1p~=0.0.5 \ No newline at end of file +ch1p~=0.0.6 \ No newline at end of file -- cgit v1.2.3