gpt4 book ai didi

javascript - 从 Node.js 返回 URL 时出现 "Error: Capture"

转载 作者:行者123 更新时间:2023-12-03 04:46:58 24 4
gpt4 key购买 nike

我使用此代码片段使 Google 搜索从给定名称开始:

var parseXlsx = require('excel');
var scraper = require('google-search-scraper');

parseXlsx('foo.xlsx', function(err, data) {
if(err) throw err;
// data is an array of arrays
for(var i=1; i<5; i++){
var stringToSearch = data[i][0];
var options = {
query: stringToSearch,
limit: 1
};
scraper.search(options, function(err, url) {
// This is called for each result
if(err) throw err;
console.log(url)
});
}
});

foo.xlsx 文件中,我有此列:

name1
name2
name3
....

我总是收到此错误,但我不知道为什么:

Error: Captcha
at Request._callback (C:\Users\user\node_modules\google-search-scraper\index.js:68:23)
at Request.self.callback (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:122:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:888:14)
at emitOne (events.js:101:20)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (C:\Users\user\node_modules\google-search-scraper\node_modules\request\request.js:839:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)

最佳答案

该错误听起来像是无法通过 RECAPCHA。

Error:Capcha

您是否尝试过使用deathbycaptcha - npm 包来解决?

https://www.npmjs.com/package/deathbycaptcha

var scraper = require('google-search-scraper');
var DeathByCaptcha = require('deathbycaptcha');

var dbc = new DeathByCaptcha('username', 'password');

var options = {
query: 'site:edu "information theory"',
age: 'y', // less than a year,
solver: dbc
};

scraper.search(options, function(err, url) {
// This is called for each result
if(err) throw err;
console.log(url)
});

关于javascript - 从 Node.js 返回 URL 时出现 "Error: Capture",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42829399/

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