scrapinghub / splash

Lightweight, scriptable browser as a service with an HTTP API
BSD 3-Clause "New" or "Revised" License
4.04k stars 508 forks source link

How to use chromium engine? #1106

Closed Rafiot closed 3 years ago

Rafiot commented 3 years ago

I have a hard time figuring out how to use the chromium engine.

If I understand the documentation right, I should be able to pass a parameter engine=chromium in a GET query:

http://127.0.0.1:8050/info?wait=0.5&images=1&expand=1&timeout=90.0&engine=chromium&url=http%3A%2F%2Fgoogle.com&lua_source=function+main(splash%2C+args)%0D%0A++assert(splash%3Ago(args.url))%0D%0A++assert(splash%3Await(0.5))%0D%0A++return+{%0D%0A++++html+%3D+splash%3Ahtml()%2C%0D%0A++++png+%3D+splash%3Apng()%2C%0D%0A++++har+%3D+splash%3Ahar()%2C%0D%0A++}%0D%0Aend

But it returns:

{
    "error": 400,
    "type": "BadOption",
    "description": "Incorrect HTTP API arguments",
    "info": "engine=chromium is not supported yet"
}

Splash is started this way: docker run -p 8050:8050 -p 5023:5023 scrapinghub/splash --disable-browser-caches --browser-engines=webkit,chromium


if I start splash with docker run -p 8050:8050 -p 5023:5023 scrapinghub/splash --disable-browser-caches --browser-engines=webkit

the error message is:

{
    "error": 400,
    "type": "BadOption",
    "description": "Incorrect HTTP API arguments",
    "info": {
        "type": "bad_argument",
        "argument": "engine",
        "description": "Disabled render engine chromium"
    }
}

Which makes sense.


And for completeness-sake, if I start splash with docker run -p 8050:8050 -p 5023:5023 scrapinghub/splash --disable-browser-caches --browser-engines=chromium

And pass engine=webkit

The error message also makes sense:

{
    "error": 400,
    "type": "BadOption",
    "description": "Incorrect HTTP API arguments",
    "info": {
        "type": "bad_argument",
        "argument": "engine",
        "description": "Disabled render engine webkit"
    }
}

Am I missing something? The chromium engine feature is in alpha mode, and I'm not planning to use it in prod any time soon, but I wanted to give it a try.

Gallaecio commented 3 years ago

You are reading the documentation of the render.html endpoint of Splash, which is not the endpoint that you are using. Chromium is only supported to render HTML, PNG and JPEG.