针不跟随重定向

时间:2018-11-08 15:52:02

标签: node.js nightmare needle.js

nodejs中有一个代码。代码使用噩梦获取Cookie,然后将其传递给neelde。用针我试图到达该页面,但是如果我保存通过fs包含的页面,则会得到状态为302的页面。如何获取我需要的页面?

public partial class Initial : Migration
{
    protected override void Up(MigrationBuilder migrationBuilder)
    {

    }

    protected override void Down(MigrationBuilder migrationBuilder)
    {
    }
}

为“ follow”,“ follow_max”之类的针设置的选项无济于事。

let proxied = Nightmare({ switches: { 'proxy-server': proxy // set the proxy server here ... }, show: true }); proxied .goto(url) .wait('input[id="id_username"]') .insert('#id_username', loginData.login) .insert('#id_password', loginData.pass) .click('input[type="submit"]') .wait('.table') .cookies.get() .end() .then(function (c) { let u = 'https://supply.elfmoney.ru/'; let options = { 'cookies': {}, 'proxy': proxy, 'follow_max': 5, 'follow': 5 // 'follow_set_cookies': true, // 'follow_set_referer': true }; for (let i = 0; i < c.length; i++) { options['cookies'][c[i]['name']] = c[i]['value']; } needle.get(u, options, function (err, resp, body) { if (err) return l(err, ' while needling'); l(resp.headers) }); }); :我解决了我的问题。我安装了另一个模块-请求。将其选项设为

UPD

0 个答案:

没有答案
相关问题