gpt4 book ai didi

javascript - 经济拒绝 127.0.0.1 :443

转载 作者:行者123 更新时间:2023-12-01 16:09:44 26 4
gpt4 key购买 nike

为什么要向本地主机发出此请求:

 {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 443,
config: {
url: 'https:\\stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2f',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.19.2'
},

我没有在我的代码中使用本地主机。但出于某种原因,axios 似乎正在使用本地主机。下面的代码是导致我在测试该功能时遇到的当前问题的原因:

function Scraper(url: string, login_page?: string){
if (login_page) {
var link: string = 'https:\\' + url + '/' + login_page;
}
else {
var link: string = 'https:\\' + url;
}
axios.get(link)
.then(responce => {
const html = responce.data;
const $ = cheerio.load(html);
const website_usr_field: Cheerio = $('input[type=email]');
//if ()
/*
TODO:
1) Create if statement for assigning login type variable for values.
*/
const website_pwd_field: Cheerio = $('input[type=password]');
console.log(website_usr_field);
console.log(website_pwd_field);
return website_usr_field && website_pwd_field;
}).catch(console.error);
}

最佳答案

会不会是网址不正确?

改变:

https:\\

到:

https://

关于javascript - 经济拒绝 127.0.0.1 :443,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63539473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com