Open kaelin opened 10 years ago
var promise = requestPromise.create();
Should be:
request = request.defaults({jar: true});
var promise = requestPromise.create( request );
The problem persist.
I'm also having the same problem,
here is my code,
var request = require('request').defaults({jar: true}), cheerio = require('cheerio'); pRequest = require("promisified-request").create(); fScraper = require("form-scraper"); var user = 'test'; var pass = 'test'; var options = { url: 'https://www.example.com', path: 'eample.jsp', method: 'GET', port: 443, auth: { user: user, pass: pass } } request(options, function(err, res, body) { if(err) { callback.call(null, new Error('Request failed')); return; } if(!err && res.statusCode === 200){ var $ = cheerio.load(body); console.log($('label').attr('for', 'sss').html()); }
var formStructure = fScraper.fetchForm("form1", "https://www.example.com/example.jsp", pRequest);
var filenumber = {sss: "1"};
fScraper.submitForm(filenumber, fScraper.provideForm(formStructure), pRequest).then( function (response) {
console.log(response.body);
});
});
The same here.
Any idea??
The same here.
same here
Guessing this is not gonna be fixed or maintained then....? Same issue as above on latest npm and node versions as of 30.5.2016
Hi, I'm having the same issue... this is how i solve it based on @redolent suggestion:
var request = require('request');
request = request.defaults({jar: true});
var pRequest = require("promisified-request").create(request);
var fScraper = require("form-scraper");
var formStructure = fScraper.fetchForm("#input", "https://tiket.kereta-api.co.id", pRequest);
//console.log(formStructure); return false;
var loginDetails = { tanggal: "20160911#Minggu, 11 September 2016", origination: "KAC#KIARACONDONG", destination: "KD#KEDIRI", adult: "1" };
fScraper.submitForm(loginDetails, fScraper.provideForm(formStructure), pRequest).then( function (response) {
console.log(response.body);
});
i had the same problem and i solved it with @mtasuandi solution.
I am trying out
form-scraper
andpromisified-request
for the first time. I've run into this error on my initial attempts:Here is my code that tries to scrape a form: