new dextools bot
This commit is contained in:
parent
b56320570b
commit
eddf32a804
36
agent-pyter/dexbot.py
Normal file
36
agent-pyter/dexbot.py
Normal file
@ -0,0 +1,36 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import schedule
|
||||
import time
|
||||
|
||||
def check_new_pairs():
|
||||
url = "https://www.dextools.io/"
|
||||
url = "https://www.dextools.io/app/en/bnb/pool-explorer"
|
||||
response = requests.get(url)
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
|
||||
# Assuming the pairs are listed in <div> tags with a class that includes the word 'pair'
|
||||
pairs = soup.find_all('div', class_=lambda x: x and 'pair' in x)
|
||||
|
||||
current_pairs = {pair.text for pair in pairs}
|
||||
|
||||
if not hasattr(check_new_pairs, "last_pairs"):
|
||||
check_new_pairs.last_pairs = current_pairs
|
||||
|
||||
new_pairs = current_pairs - check_new_pairs.last_pairs
|
||||
if new_pairs:
|
||||
print("New Pairs Found:", new_pairs)
|
||||
# Here you can add the code to trigger any event (e.g., send an email, a notification, etc.)
|
||||
|
||||
# Update the last checked pairs
|
||||
check_new_pairs.last_pairs = current_pairs
|
||||
|
||||
def main():
|
||||
schedule.every(10).seconds.do(check_new_pairs)
|
||||
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user