From 1e6136e05ae923f25922f034a0c70074f45875c0 Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Sat, 6 Jun 2020 19:16:09 +0200 Subject: fix fetching response body --- index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'index.js') diff --git a/index.js b/index.js index a307db8..c8661cd 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,5 @@ const puppeteer = require('puppeteer-extra'); const StealthPlugin = require('puppeteer-extra-plugin-stealth'); -const AdblockerPlugin = require('puppeteer-extra-plugin-adblocker'); -puppeteer.use(AdblockerPlugin()); puppeteer.use(StealthPlugin()); const Koa = require('koa'); const bodyParser = require('koa-bodyparser'); @@ -76,7 +74,7 @@ const responseHeadersToRemove = ["Accept-Ranges", "Content-Length", "Keep-Alive" response = await page.goto(url, { timeout: 30000, waitUntil: 'domcontentloaded' }); if ((await page.content()).includes("cf-browser-verification")) response = await page.waitForNavigation({ timeout: 30000, waitUntil: 'domcontentloaded' }); - responseBody = await page.content(); + responseBody = await response.text(); responseHeaders = response.headers(); const cookies = await page.cookies(); if (cookies) -- cgit v1.2.3