JimmyLaurent / cloudflare-scraper

A package to bypass Cloudflare's protection
MIT License
289 stars 30 forks source link

Post metods whith data parametrs #21

Closed soroka41 closed 3 years ago

soroka41 commented 3 years ago

const browser = await puppeteer.launch(LAUNCH_PUPPETEER_OPTS_ALL) const pageSearch = await browser.newPage() await pageSearch.setRequestInterception(true) await pageSearch.on('request', interceptedRequest => { let data = { 'method': 'POST', 'postData': payload, 'headers': { ...interceptedRequest.headers(), "Content-Type": "application/json" } }; interceptedRequest.continue(data); }) await pageSearch.goto(url) const resultsCars = await pageSearch.content() await browser.close() ................................................... How to implement this with await cloudflareScraper.post (url, data)

soroka41 commented 3 years ago

replacement postData: {} on body: {} --- good works

let data = { body: payload, headers: { "Content-Type": "application/json", 'accept-language': 'en-US,en;q=0.9' } } const response = await cloudflareScraper.post(url, data)