diff --git a/.gitignore b/.gitignore index 854e719..25b2b34 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ tts/*.m4a agent-mobile/jdk/* agent-mobile/artimobile/supervisord.pid agent-pyter/lag-llama +agent-pyter/google-chrome-stable_current_amd64.deb diff --git a/agent-pyter/dexbot.py b/agent-pyter/dexbot.py index e90ef26..ff4a706 100644 --- a/agent-pyter/dexbot.py +++ b/agent-pyter/dexbot.py @@ -1,15 +1,55 @@ + +# 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 + +# 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
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...") 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') + # make html dump to ./dextools-last.html + with open('./dextools-last.html', 'w') as f: + f.write(soup.prettify()) + # Assuming the pairs are listed in
tags with a class that includes the word 'pair' pairs = soup.find_all('div', class_=lambda x: x and 'pair' in x) @@ -27,11 +67,12 @@ def check_new_pairs(): check_new_pairs.last_pairs = current_pairs def main(): - schedule.every(10).seconds.do(check_new_pairs) + #schedule.every(10).seconds.do(check_new_pairs) while True: - schedule.run_pending() - time.sleep(1) + # schedule.run_pending() + check_pairs_sel() + time.sleep(10000) if __name__ == "__main__": main() diff --git a/agent-pyter/prompts.txt b/agent-pyter/prompts.txt new file mode 100644 index 0000000..d066faf --- /dev/null +++ b/agent-pyter/prompts.txt @@ -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 \ No newline at end of file