pyppeteer PageError: net::ERR_INVALID_RESPONSE Python

Run the code from the example:

import asyncio
from pyppeteer import launch


async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto('https://www.tiktok.com/@justinbieber')
    await browser.close()

asyncio.get_event_loop().run_until_complete(main())

I get the error:

File "/home/PycharmProjects/First/Start.py", line 8, in main await page.goto('https://www.tiktok.com/@justinbieber') File "/usr/local/lib/python3.8/dist-packages/pyppeteer/page.py", line 879, in goto raise PageError(result) pyppeteer.errors.PageError: net::ERRINVALIDRESPONSE at https://www.tiktok.com/@justinbieber

Opens other links correctly. How do I fix the error?

UPD (12.08.2021):

If you turn off the browser hide mode, then everything works:

browser = await launch(headless=False)

Asked Oct 07 '21 12:10
avatar feschenkovladimir
feschenkovladimir

3 Answer:

I suspect this has to do with TikTok detecting chromium being controlled by pyppeteer and messing up the response. ERRINVALIDRESPONSE is a Chrome error, not a pyppeteer error. That's not to say pyppeteer can't cause that error by I think it's unlikely

1
Answered Aug 15 '21 at 04:53
avatar  of Mattwmaster58
Mattwmaster58

I suspect this has to do with TikTok detecting chromium being controlled by pyppeteer and messing up the response. ERRINVALIDRESPONSE is a Chrome error, not a pyppeteer error. That's not to say pyppeteer can't cause that error by I think it's unlikely

Yes, I understand. At the same time, if you disable headless mode, then this error does not occur.

Checked on the original puppeteer (JavaScript): it gets this error in headless mode. But if you use the puppeteer-extra-plugin-stealth plugin, then there is no error in headless mode. Maybe you can take something from this plugin to get around this error?

1
Answered Aug 15 '21 at 07:11
avatar  of feschenkovladimir
feschenkovladimir

That's out of the scope of this project unfortunately so I'm closing this for now. I don't think it would be too hard to look into how that stealth plugging add-on does its thing and implement with pyppeteer, maybe you could even make a port while you're at it 😉

1
Answered Aug 15 '21 at 07:18
avatar  of Mattwmaster58
Mattwmaster58