修复了扑飞 不加载图片

This commit is contained in:
luyuan 2020-12-18 15:19:33 +08:00
parent 24c682dcf4
commit d80c21fcd8
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 9 additions and 4 deletions

View File

@ -4,11 +4,14 @@ let mainurl = "http://www.alimanhua.com/"
let gethtml = (name) => {
return new Promise(async (res, rej) => {
puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
}).then(async (browser) => {
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'webdriver', { get: ()=> false });
});
try {
await page.goto(mainurl);
} catch (error) {

View File

@ -5,11 +5,13 @@ let gethtml = (name) => {
return new Promise(async (res, rej) => {
puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
}).then(async (browser) => {
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'webdriver', { get: ()=> false });
});
// await page.goto(mainurl);
try {
await page.goto(mainurl);