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
  • 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()

📘

TypeScript developers

You can find Buster's module typing in our GitHub.

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(() => {
  console.log('Folder saved')
})
process.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}`)
    process.exit(1)
  } else {
    process.exit(0)
  }
});

This is even better:

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

Reference

📘

Buster's Reference

All Buster's methods are listed and documented in the BusterJS API reference