This commit is contained in:
Dobromir Popov
2024-05-18 01:18:28 +03:00
9 changed files with 155 additions and 52 deletions

View File

@ -1,10 +1,67 @@
# source /path/to/virtualenv/bin/activate # On Unix or MacOS
# source /config/miniconda3/envs/py/bin/activate
# pip install requests beautifulsoup4 schedule selenium
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# sudo dpkg -i google-chrome-stable_current_amd64.deb
# apt install libnss3 libxss1
import requests
from bs4 import BeautifulSoup
# import schedule
# # import schedule
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
# pip install requests beautifulsoup4 schedule
# Initialize WebDriver
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
def check_pairs_sel():
try:
# Open the page
driver.get("https://www.dextools.io/app/en/bnb/pool-explorer")
time.sleep(10) # Wait for JavaScript to execute
# Extract the page source
html = driver.page_source
soup = BeautifulSoup(html, '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)
print("Pairs found:", [pair.text for pair in pairs])
finally:
driver.quit()
# Initialize WebDriver
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
def check_pairs_sel():
try:
# Open the page
driver.get("https://www.dextools.io/app/en/bnb/pool-explorer")
time.sleep(10) # Wait for JavaScript to execute
# Extract the page source
html = driver.page_source
soup = BeautifulSoup(html, '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)
print("Pairs found:", [pair.text for pair in pairs])
finally:
driver.quit()
def check_new_pairs():
# log the running time
print("Checking for new pairs...")
@ -14,7 +71,7 @@ def check_new_pairs():
soup = BeautifulSoup(response.text, 'html.parser')
# make html dump to ./dextools-last.html
with open('dextools-last.html', 'w') as f:
with open('./dextools-last.html', 'w') as f:
f.write(soup.prettify())
# Assuming the pairs are listed in <div> tags with a class that includes the word 'pair'
@ -38,7 +95,7 @@ def main():
while True:
# schedule.run_pending()
check_new_pairs()
check_pairs_sel()
time.sleep(10000)
if __name__ == "__main__":

1
agent-pyter/prompts.txt Normal file
View File

@ -0,0 +1 @@
create python app that will monitor for new pairs on https://dextools.io and trigger event immediately when there is new token