I am trying to extract some information from the tricky JavaScript URL in the below code. This answer works great on my laptop: save-troublesome-webpage-and-import-back-into-python
I am however trying to run in this in Google Colab but I am getting the error:
BrowserError: Browser closed unexpectedly:
/root/.local/share/pyppeteer/local-chromium/575458/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory
Here is the code that works on laptop (thanks @kcorlidy):
from requests_html import HTMLSession
url = "https://www.soccer24.com/match/C4RB2hO0/#match-summary"
session = HTMLSession()
response = session.get(url)
response.html.render()
result = response.html.xpath('//*[@id="default-odds"]/tbody/tr/td[2]/span/span[2]/span/text()')
print(result)
#['9.20']
I feel it has something to do with !ldconfig
but I am out of my depth here 'a bit'. I also tried selenium
, got the old classic error which I don't know how to fix in Colab despite much searching: WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home