BusterJS agent module

Give your bots superpowers. BusterJS API reference

The Agent Module (also called buster or BusterJS) is a special module made by the Phantombuster team. It provides very cool features and is linked to your Phantombuster account.

Here's a short list of what you can do with our module:

  • Save files to your persistent storage
  • Download files to your agent's disk
  • Indicate the progress of your agent
  • Set or reset the time limit of your agent
  • Send emails & notifications
  • Interact with MongoDB databases
  • Solve CAPTCHAS
  • ...

Initialization

The agent module is named phantombuster. Use require('phantombuster') to get the Buster class and instantiate it.

const Buster = require("phantombuster")
const buster = new Buster()

Methods are asynchronous

Following the philosophy of Node, most methods of the agent module are asynchronous. You have to use the callback function to know when (and if) a call finished successfully.

Or use async/await! You totally should use async/await instead of callbacks.

For example, this is bad:

buster.saveFolder(function() {
  console.log('Folder saved')
})
nick.exit() // BAD! saveFolder() will not have finished here, in fact it will not even have started!

This is better:

buster.saveFolder(function(err) {
  if (err) {
    console.log(`Error when saving folder: ${err}`)
    nick.exit(1)
  } else {
    nick.exit(0)
  }
});

This is even better:

try {
  await buster.saveFolder()
  nick.exit(0)
} catch(e) {
  console.log(`Caught exception: ${e}`)
  nick.exit(1)
}

Reference

All methods are listed and documented here:
BusterJS API reference