diff options
author | Emilien Devos <contact@emiliendevos.be> | 2020-06-06 19:16:09 +0200 |
---|---|---|
committer | Emilien Devos <contact@emiliendevos.be> | 2020-06-06 19:16:09 +0200 |
commit | 1e6136e05ae923f25922f034a0c70074f45875c0 (patch) | |
tree | 810cd3de49c9d3c7ae9948c915cda4374b350880 /index.js | |
parent | 733ab1b3d2996eed30aa3f15ac115ad4a710d3fa (diff) |
fix fetching response body
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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) |