侏儒隐身
pyppeteer-stealth的Python项目详细描述
侏儒隐身
移植自puppeteer-extra-plugin-stealth,不完美。
用法
importasynciofrompyppeteerimportlaunchfrompyppeteer_stealthimportstealthasyncdefmain():browser=awaitlaunch(headless=True)page=awaitbrowser.newPage()awaitstealth(page)# <-- Hereawaitpage.goto("https://bot.sannysoft.com/")awaitbrowser.close()asyncio.get_event_loop().run_until_complete(main())
测试结果
无潜行的侏儒
<figure class="image"><figcaption>headless</figcaption></figure> | <figure class="image"><figcaption>headful</figcaption></figure> |
潜行的侏儒
<figure class="image"><figcaption>headless</figcaption></figure> | <figure class="image"><figcaption>headful</figcaption></figure> |