diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-09-16 17:01:10 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-09-16 17:01:10 +0300 |
commit | 38f3737e7213701e4be01668dff181b7db3f8f7a (patch) | |
tree | 71a438af9797c29062a1c2a6cc337f3adf0b397e /binance-scraping-bot.py | |
parent | c2dbff2e2af459ce189b31fa4871bb0023c6bb21 (diff) |
fix parsing, add telegram notifications
Diffstat (limited to 'binance-scraping-bot.py')
-rw-r--r-- | binance-scraping-bot.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/binance-scraping-bot.py b/binance-scraping-bot.py deleted file mode 100644 index 79fae56..0000000 --- a/binance-scraping-bot.py +++ /dev/null @@ -1,44 +0,0 @@ -import os, requests
-import pandas as pd
-from bs4 import BeautifulSoup
-from requests import get
-from discord_webhook import DiscordWebhook
-
-# Webhook settings
-url_wb = os.environ.get('DISCORD_WH')
-
-# Data for the scrap
-url = "https://www.binance.com/en/support/announcement"
-response = get(url)
-soup = BeautifulSoup(response.text, 'html.parser')
-news_list = soup.find_all(class_ = 'css-sbrje5')
-
-# Create a bag of key words for getting matches
-key_words = ['list', 'token sale', 'open trading', 'opens trading', 'perpetual', 'defi', 'uniswap', 'airdrop']
-
-# Open old database file
-path = "/home/pi/OpenAlpha/db.xlsx"
-df = pd.read_excel(path)
-
-# Empty list
-updated_list = []
-
-for news in news_list:
- article_text = news.text
-
- # Check for matchings
- for item in key_words:
- if (item in article_text.lower()) and (article_text not in df.values):
- article_link = 'https://www.binance.com' + news.get('href')
- msg = article_text + '\n' + article_link
- updated_list.append([article_text, article_link])
- print(article_text)
-
- # Send message to Discord server
- webhook = DiscordWebhook(url=url_wb, content=msg)
- response = webhook.execute()
-
-# Export updated news to Excel
-cols = ['Text', 'Link']
-df = df.append(pd.DataFrame(updated_list, columns=cols), ignore_index = True)
-df.to_excel(path, index = False)
|