I'm trying to write a web crawler program using quickscrape, after I type
quickscrape \
--url \
--scraper journal-scrapers/scrapers/peerj.json \
--output peerj-384
--outformat bibjson
and hit the "Enter" in my terminal, the library will generate the result from the crawler and put them into a folder.
Now I want to write a javascript progarm so that is will call these terminal mands for me, but I am not sure how to interact with terminal in node.js.
I'm trying to write a web crawler program using quickscrape, after I type
quickscrape \
--url https://peerj./articles/384 \
--scraper journal-scrapers/scrapers/peerj.json \
--output peerj-384
--outformat bibjson
and hit the "Enter" in my terminal, the library will generate the result from the crawler and put them into a folder.
Now I want to write a javascript progarm so that is will call these terminal mands for me, but I am not sure how to interact with terminal in node.js.
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 5, 2016 at 16:28 DeidaraDeidara 6772 gold badges14 silver badges28 bronze badges 1- Possible duplicate of Execute and get the output of a shell mand in node.js – Damjan Pavlica Commented Jul 17, 2018 at 12:58
1 Answer
Reset to default 7I think child_process is that you need. https://nodejs/api/child_process.html
let exec = require('child_process').exec;
exec('quickscrape --url https://peerj./articles/384 --scraper journal-scrapers/scrapers/peerj.json --output peerj-384 --outformat bibjson', (error, stdout, stderr) => {
//...
})
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744288107a4566898.html
评论列表(0条)