pyppeteer_stealth
pyppeteer_stealth copied to clipboard
Under the root user of Linux, if I set --no-sandbox, stealth fails
Under the root user of Linux, if I set --no-sandbox, stealth fails
import asyncio
from pyppeteer import launch
from pyppeteer_stealth import stealth
async def main():
opt = {'headless': True,'args': ['--no-sandbox']}
browser = await launch(opt)
page = await browser.newPage()
await stealth(page) # <-- Here
await page.goto("https://bot.sannysoft.com/")
print(await page.content())
await browser.close()
asyncio.run(main())
result:
But if I modify the source code of pyppeteer, write --no-sandbox
directly in the DEFAULT_ARGS of the source code, it will take effect.
import asyncio
from pyppeteer import launch
from pyppeteer_stealth import stealth
async def main():
browser = await launch(headless=True)
page = await browser.newPage()
await stealth(page) # <-- Here
await page.goto("https://bot.sannysoft.com/")
print(await page.content())
await browser.close()
asyncio.run(main())
遇到了相同的问题