1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| from selenium import webdriver
import time
from bs4 import BeautifulSoup
import requests
from web3 import Web3
from ens import ENS
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import csv
from tqdm import tqdm
import os
import math
import csv
def get_informations(dict_result):
print("start website")
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
print('opion done')
count = 0
browser = webdriver.Chrome(options=options)
# browser = webdriver.Chrome(executable_path='/home/gary/loca/chromedriver',options=options)
print('dodo')
for key, value in tqdm(dict_result.items(), desc="Getting Wallet From website"):
try:
if key:
browser.get(
'https://website.com/usefull/' + key)
soup = BeautifulSoup(browser.page_source, 'html.parser')
time.sleep(5)
print('https://website.com/usefull/' + key)
price = soup.select('#ContentPlaceHolder1_divSummary > div.row.g-3.mb-4 > div:nth-child(1) > div > div > div:nth-child(3)')[0].text.split('(')
final_price = 'UNKNOWN'
gr = price[0].split('$')
final_price = gr[-1]
final_price = final_price.replace(',','')
print(math.floor(float(final_price)))
dict_result[key].append(math.floor(float(final_price)))
age = soup.select('#transactions > div > div.table-responsive > table > tbody > tr:nth-child(1) > td.showAge > span')
if key in browser.page_source:
a = soup.select('#transactions > div > div.table-responsive > table > tbody')
for e in a:
if key in e.text:
dict_result[key].append(key)
else:
dict_result[key].append('NO')
dict_result[key].append(age[0].text)
count +=1
print ('Il y a '+ str(count) + ' match')
else:
dict_result[key].append("Aucune info")
dict_result[key].append("Aucune info")
except Exception as err:
print('ERROR GETTING website INFORMATIONS', err)
dict_result[key].append("Aucune info")
dict_result[key].append("Aucune info")
return dict_result |
Partager