aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-09-16 17:27:22 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-09-16 17:27:22 +0300
commit473e160f1df08847663aad6d9d3c667552d0f8a7 (patch)
tree00860fa90b7dca7a3f563a6ce53a202e9a076a17
parent7be17ff7ef6efd38d4dd013042bbf1a42332601b (diff)
fixes
-rwxr-xr-xbinance-announcements-scraping-bot.py12
-rw-r--r--requirements.txt2
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"<i>{category['title']}</i>\n"
- buf += '\n'.join(list(map(lambda item: f"<a href=\"{item['link']}\">{item['text']}</a>", updates)))
+ buf = f"<b>{category['title']}</b>\n"
+ buf += '\n'.join(list(map(lambda item: f"<a href='{item['link']}'>{item['text']}</a>", updates)))
blocks.append(buf)
if blocks:
message = '<b>Binance Announcements</b>\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