使用p操纵者绕过广告

时间:2020-08-31 17:10:47

标签: javascript node.js puppeteer

我正在尝试从特定网站下载一堆带有伪造者的epub,但是广告一直在过程中显示,脚本等待部分g加载,但由于广告阻止了该脚本,请帮忙。

这是我的代码:

const puppeteer = require("puppeteer");
const cheerio =require("cheerio");


(async function main(){
    try{    
    //const browser= await puppeteer.launch({headless:false});
    const browser = await puppeteer.launch({headless:false});
    const page = await browser.newPage();
    await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36")
    await page.goto("https://www.planetebook.com/");
    await page.waitForSelector(".pefooterlknk");
    const books=await page.$$(".pelistlinks");
    const button = await books[0].$("a");
    await button.click();
    await page.waitForSelector(".buttonpe");
    const epubs=await page.$$(".fusion-text");
    const button1=await epubs[0].$("a.buttonpe") 
    await button1.click()
    //await browser.close();
    }
    catch(e){
        console.log("our error",e);
    }
})();

0 个答案:

没有答案