나는 본질적으로 페이지를 긁어 내려고합니다. 이 URL을 클릭하면 긁힌 자국의 결과가 출력됩니다. 처음에는 모든 것이 멋지게 작동합니다. 두 번째 시도 (다른 매개 변수가 job.options.args를 통해 전달됨) node.io 작업의 run() 함수도 실행하지 않습니다. scrape_result
는 두 번째로 빈 상태를 반환합니다 (객체가 필요함).Node.io 긁어 모으기 작업이 두 번째 실패합니다.
의견이 있으십니까? 새로운 결과가 두 번째로 반환되도록하려면 어떻게해야합니까? 내 스크랩 작업을 위해 나는 거의 정확하게 여기에서 예 # 3을 사용하고 있습니다 : https://github.com/chriso/node.io/wiki/Scraping
발췌 scraper.js에서 (나머지는 예 # 3과 같다 : https://github.com/chriso/node.io/wiki/Scraping) 다음
run: function() {
var book = this.options.args[0].book;
var chapter = this.options.args[0].chapter;
this.getHtml('http://www.url.com' + book + '/' + chapter + '?lang=eng', function(err, $) {
내 app.js
을var scrip_scraper = require('./scraper.js');
app.get('/verses/:book/:chapter', function (req, res) {
var params = {
book: req.param('book'),
chapter: req.param('chapter')
}
scrip_scraper.job.options.args[0] = params;
//scrip_scraper.job.options.args.push(chapter);
console.log(scrip_scraper.job.options.args);
nodeio.start(scrip_scraper, function (err, scrape_result) {
console.log(scrape_result);
}, true);
}); //app.get('/verses/:book/:chapter')
내가 당신을 돕기 위해 우리가 필요가 있다고 생각 app.js의 더 많은 코드를 참조하십시오. 'scrip_scraper'는 어떻게 만들었습니까? 나는'scrip_scraper.job.options.args [0] = params;'가 당신이하고 싶은 일을하고 있다고 생각하지 않습니다. – Max
@Max 위 코드를 더 추가했습니다. 나는 긁힌 직업에 논쟁을 전달하는 적절한 방법을 알아 내지 못했습니다. options.args [0]를 사용하는 것이 내가 생각할 수있는 최선의 방법이었습니다. 그것은 아름답게 처음으로 작동합니다. 두 번째로, run()은 실행조차 보이지 않습니다. –