反爬虫优化,评论图片支持
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// index.js
|
||||
import { chromium } from 'playwright-extra';
|
||||
import stealth from 'puppeteer-extra-plugin-stealth'
|
||||
|
||||
chromium.use(stealth());
|
||||
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: false }); // 需要可视化就 false
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto('https://bot.sannysoft.com/'); // 常用自测页
|
||||
console.log('Title:', await page.title());
|
||||
await page.screenshot({ path: 'stealth.png', fullPage: true });
|
||||
setTimeout(async () => {
|
||||
await browser.close();
|
||||
}, 1000_000);
|
||||
})();
|
||||
Reference in New Issue
Block a user