Python Forum
Web scraping Possible JavaScript issue - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Web scraping Possible JavaScript issue (/thread-33255.html)



Web scraping Possible JavaScript issue - johnboy1974 - Apr-10-2021

Hi,

I'm trying to scrape the values from the following url 'https://sports.williamhill.com/betting/en-gb/in-play/football' and using requests.get to call it.

When I inspect the element and search for some text next to the value in the response, it has what looks like to be a java script function.

In the attached, I'm trying to extract the score of the match that's 1-4. As per the right hand side, I'm searching the response for the text '__livescore-item team-a">'

Browser:
https://pasteboard.co/JWIGpGp.png

Response:
https://pasteboard.co/JWII0JL.png

I've also tried render from HTMLSession but that didn't seem to work either :(

Cheers,
J


RE: Web scraping Possible JavaScript issue - ndc85430 - Apr-11-2021

Don't they have an API you can use instead of scraping the page?


RE: Web scraping Possible JavaScript issue - johnboy1974 - Apr-11-2021

(Apr-11-2021, 04:30 AM)ndc85430 Wrote: Don't they have an API you can use instead of scraping the page?

They do but you need to be part of some developer network. I applied for that but was rejected :( That was some time ago but looking as of late, they've stopped issuing api keys :(