I’m trying now since over 48 hours and googelt almost the whole web. My problem is that when use puppeteer the POST Request is not working – I tried many websites but the POST Form Action is not working. Can somebody help me?
File test.js
Usage: node test.js
const puppeteer = require('puppeteer');
const randomUseragent = require('random-useragent');
const USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36';
(async () => { const browser = await puppeteer.launch({ args: ['--no-sandbox'] }) // headless: true,
const page = await browser.newPage()
await page.setViewport({
width: 1920 + Math.floor(Math.random() * 100),
height: 3000 + Math.floor(Math.random() * 100),
deviceScaleFactor: 1,
hasTouch: false,
isLandscape: false,
isMobile: false,
});
const userAgent = randomUseragent.getRandom();
const UA = userAgent || USER_AGENT;
await page.setUserAgent(UA);
await page.setJavaScriptEnabled(true);
await page.setDefaultNavigationTimeout(0);
await page.setRequestInterception(true);
page.on("request", interceptedRequest => {
var data = {
"method": "POST",
"postData": "URLz=VIDEOURL"
};
interceptedRequest.continue(data);
});
const response = await page.goto('https://fdown.net/download.php')
//const responseBody = await response.text();
await page.screenshot({ path: 'affe.png', fullPage: true })
await browser.close()
})()