fattmarley / cbbscraper

College Basketball web scraper that pulls predicted scores from Kenpom HaslaMetrics and BartTorvik as well as betting lines from Fanduel using Selenium
7 stars 3 forks source link

Fanduel xpath is not valid #1

Open dckeller44 opened 1 year ago

dckeller44 commented 1 year ago

This tool is great!!! I figured out about everything else, this is my first time using selenium or any type of scraper for that matter but I could not find the correct fanduel xpath to get the lines in, should be a quick fix but I am way out of my depth

fattmarley commented 1 year ago

Glad you like it! I think it’s probably because fanduel updated their website so the path has changed. I wrote the program a few years ago but you basically just need to use the “driver.get” line to navigate the web driver to fanduel’s homepage, so that URL and the “url” line should be updated to whatever the url is when you’re at the homepage. Then BeautifulSoup’s html.parser finds all the betting lines. It looks like the xpath might be “/html/body/div[1]/div/div[2]/div[1]/div/div[2]/div/nav/div/ul/li[3]/div“. Classes are different so not sure what the fix there is, may need to find page elements by something other than class, but I was finding xpaths and classes by using google chrome’s “inspect” feature by right clicking on fanduels homepage and selecting inspect, and looking at the page elements. Hope that might point you in the right direction. Im certainly no expert either!

On Nov 16, 2022, at 7:07 PM, dckeller44 @.***> wrote:

 This tool is great!!! I figured out about everything else, this is my first time using selenium or any type of scraper for that matter but I could not find the correct fanduel xpath to get the lines in, should be a quick fix but I am way out of my depth

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

fattmarley commented 1 year ago

Looking at the page elements, /html/body/div[1]/div/div[2]/div[3]/div/a[8] might even work better for the xpath. Still not sure about the classes but I'll have more time in december so maybe I'll mess around with this project again