-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject-v3.py
More file actions
56 lines (33 loc) · 1.64 KB
/
project-v3.py
File metadata and controls
56 lines (33 loc) · 1.64 KB
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
# Specify the path to chromedriver.exe
chromedriver_path = "C:\\Program Files (x86)\\chromedriver.exe"
# Set up Chrome options
chrome_options = Options()
# Set up the Chrome service
service = Service(executable_path=chromedriver_path)
# Initialize the driver with the service and options
driver = webdriver.Chrome(service=service, options=chrome_options)
driver.get("https://www.bitstamp.net/crypto-lending/")
print(driver.title)
search_name = driver.find_elements(By.CLASS_NAME, "currency__name")
search_number = driver.find_elements(By.CLASS_NAME, "text--positive.text--medium")
# Filter out elements with empty text
non_empty_elements = [element for element in search_number if element.text.strip()]
for element, number in zip(search_name, non_empty_elements):
print(f'Currency: {element.text}, reward: {number.text}')
'''
for element, number in zip(search_name, search_number):
if "+" in number.text: #If they ofer some special bonus sum the reward.
string = number.text
percentages = [float(p.replace('%', '')) for p in string.split('\n') if '%' in p]
# Calculating the total sum of the percentages
total_percentage = round(sum(percentages),2)
print(f'Currency: {element.text}, reward: {total_percentage}')
else:
print(f'Currency: {element.text}, reward: {number.text}')
#search_number = driver.find_element(By.CLASS_NAME, "css-1yx7dzk")
'''