Pyton request-html is not downloading Chromium

2.6k Views Asked by At
import requests
from bs4 import BeautifulSoup
from requests_html import HTMLSession
url="https://dmarket.com/ingame-items/item-list/csgo-skins?title=recoil%20case"
sesion = HTMLSession()
response = sesion.get(url)
response.html.render()
soup = BeautifulSoup(response.html.html, features="html.parser")
print(soup)

After run it said

[INFO] Starting Chromium download.

After that crashes with this in VS Code:

Chromium downloadable not found at https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1181205/chrome-win.zip: Received <?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Details>No such object: chromium-browser-snapshots/Win_x64/1181205/chrome-win.zip</Details></Error>

I tried installing different versions of requests_html

3

There are 3 best solutions below

1
Lk4m1 On

requests-html uses pyppeteer library to download chromium, and it looks like version 1181205 of chromium which is hardcoded in pyppeteer has been removed from google storage.

Since requests-html installs pyppeteer with it, a simple workaround can be updating line 20 of pyppeteer's __init__.py file in your env:

__chromium_revision__ = '1181205' -> __chromium_revision__ = '1263111'

Note: I used version 1263111 because it's the latest for Win_x64 at the time of answering, and it works fine.

UPDATE

Thanks to @Abdul Aziz Barkat's comment, it turns out that you can specify chromium version through environment variables, and pyppeteer will use it.

PYPPETEER_CHROMIUM_REVISION = '1263111'
0
Gerardo J.M. Serrano Gallego On

I had the same problem, and I fixed it by using an old version of PYPPETEER. The first time, I programmed a script with Linux and didn't encounter any issues. However, when I used another PC with Windows, I encountered the problem, so I resorted to using a different, older version. For example, it doesn't work with PYPPETEER version 2.0.0, but if I use PYPPETEER version 1.0.0, it functions perfectly well.

0
user23742855 On

Use the following commands: 1-pip uninstall pyppeteer 2-pip install pyppeteer==1.0.0

it worked for me