1

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

GivenX
  • 495
  • 1
  • 8
  • 17
  • 1
    None of the suggested answers relate to errors encountered when using Google Colab (hence my bold Colab in the question). – GivenX Nov 30 '18 at 12:31
  • When you comment with a clarification please append the `@` sign along with the _username_ so the message is delivered to the recipient's inbox. Else the recipient will have no idea about your question/comment update to take any further action. – undetected Selenium Nov 30 '18 at 12:59
  • I have updated the canonical duplicate targets of this discussion. Perhaps you can use **`!wget`** and **`!unzip`** to **download**, **unzip** commands and start using the matching _ChromeDriver_ version. – undetected Selenium Nov 30 '18 at 13:02
  • the selenium error message is pretty explicit about how to fix it. "'chromedriver' executable needs to be in PATH" means you should add the chromedriver executable to your PATH environment variable. – Corey Goldberg Nov 30 '18 at 13:44
  • ....and how does one do that, in Colab...? Please. If anyone has got this working in Colab, it would be great to find out exactly how you cracked it... – GivenX Dec 03 '18 at 10:18

0 Answers0