-2
ノードホースマンは私のローカルサーバー上で完全に動作しますが、私はそれを紺色に置くと動作しません。 node-horsemanはnode.jsのヘッドレスブラウザモジュールです。 紺碧が外部リンクからのアクセスをブロックしていると思いますが、どうすればこのロックを解除できますか?ノードホースマンが紺碧で働くには何が必要ですか?
const Horseman = require('node-horseman');
const users = ['PhantomJS', 'nodejs'];
var express = require('express'),
http = require('http'),
app = express();
app.get('/', function (req, res) {
res.send("Deu certo!");
console.log("Funcionou");
});
app.get('/twitter/', function (req, res) {
var retorno = ``;
var extracoes = 0;
console.log("aqui");
users.forEach((user) => {
const horseman = new Horseman();
horseman
.open(`http://twitter.com/${user}`)
.text('.ProfileNav-item--followers .ProfileNav-value')
.then((text) => {
retorno += `${user}: ${text}<br>`;
extracoes ++;
if (extracoes == users.length) {
res.send(retorno);
}
})
.close();
});
});
app.set('port', process.env.PORT || 3000);
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
コードを表示してください。スタックオーバーフローはあなたからの閉鎖理由を隠すので:*デバッグのヘルプを求める質問( "なぜこのコードは機能していないの?")は、質問自体にそれを再現するのに必要な特定の問題やエラー、 。明確な問題文がない質問は、他の読者にとって有用ではありません。参照:[最小限で完全で検証可能なサンプルの作成方法](https://stackoverflow.com/help/mcve)* – jww