-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnbaplayer.py
More file actions
36 lines (23 loc) · 1.26 KB
/
nbaplayer.py
File metadata and controls
36 lines (23 loc) · 1.26 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
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
PATH="C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
player=input("What is the name of the NBA player?")
driver.get("https://www.statmuse.com/")
sleep(10)
Search=driver.find_element(By.XPATH,"/html/body/main/div[3]/div[2]/div/ask-bar/form/div/div[1]/textarea")
Search.send_keys(player)
Search.send_keys(u'\ue007')
sleep(10)
rebounds=driver.find_element(By.XPATH,"/html/body/div[3]/div/div[1]/div[3]/div/div/div[2]/p[2]")
sleep(10)
ppg=driver.find_element(By.CLASS_NAME,"text-3xl")
sleep(10)
assists=driver.find_element(By.XPATH,"/html/body/div[3]/div/div[1]/div[3]/div/div/div[3]/p[2]")
sleep(5)
career=driver.find_element(By.XPATH,"/html/body/div[3]/div/div[1]/div[3]/div/p")
if career.text=="CAREER":
print("During his career,"+" "+player+" "+"averaged"+ " "+ ppg.text+" "+ "points,"+ " "+ rebounds.text+" "+"rebounds"+" "+assists.text+" "+"assists"+" "+"per game.")
else:
print("During the 2021-2022 NBA season," + " " + player + " "+ "averaged" + " " + ppg.text +" " + "points,"+ " "+ "and" +" "+ rebounds.text+" "+"rebounds"+" "+assists.text+" "+"assists"+ " "+ "per game.")