-2

I'm trying to write a web crawler program using quickscrape, after I type

quickscrape \
  --url https://peerj.com/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 commands for me, but I am not sure how to interact with terminal in node.js.

1

1 Answer 1

7

I think child_process is that you need. https://nodejs.org/api/child_process.html

let exec = require('child_process').exec;
exec('quickscrape --url https://peerj.com/articles/384 --scraper journal-scrapers/scrapers/peerj.json --output peerj-384 --outformat bibjson', (error, stdout, stderr) => {
    //...
})
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.