trade dextools devika prompts
This commit is contained in:
@ -1,14 +1,22 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import schedule
|
||||
# import schedule
|
||||
import time
|
||||
# pip install requests beautifulsoup4 schedule
|
||||
|
||||
|
||||
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 <div> tags with a class that includes the word 'pair'
|
||||
pairs = soup.find_all('div', class_=lambda x: x and 'pair' in x)
|
||||
|
||||
@ -26,11 +34,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_new_pairs()
|
||||
time.sleep(10000)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Reference in New Issue
Block a user