Search code examples
javascriptdatabaseweb-scrapingrethinkdb

scraped info to my database (using rethinkdb)


I want to create a database using scraped info. How can I link the framework (totaljs) and the database (rethinkdb) with my scraped aps so when i run the scrape programs they fill the DB. I'm using totaljs as framework.


Solution

  • To do this is necessary to open a new process like this:

    const spawn = require('child_process').spawn;
    const options = {
      cwd: '/working_directory/'
    };
    
    scrappers = {
      rProperties:  () => {
        var runApi = spawn('command', ['second_argument'], options)
        runApi.stdout.on('data', (data) => {
          data = JSON.parse(data)
    
    
        });
      }
    }