Currently, I’m learning the Puppeteer library on Node.js. I want to access some Twitter profiles, but I encountered this block issue:
throw new Errors_js_1.ProtocolError(‘Could not load body for this request. This might happen if the request is a preflight request.’);
ProtocolError: Could not load body for this request. This might happen if the request is a preflight request.
Here is my code on Node.js:
const puppeteer = require('puppeteer');
const accessURL = async ({url}) => {
const browser = await puppeteer.launch({ headless: false, executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' });
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle2", timeout: 0 });
await browser.close();
}
module.exports = {
accessURL,
};
My code is very basic for accessing websites, but this issue only occurs when I access a Twitter page. What causes this issue, and how can I solve it?