pinterpreterdeprecated

an interpreter layer for puppeteer, optimized for running browser automation

Usage no npm install needed!

<script type="module">
  import pinterpreter from 'https://cdn.skypack.dev/pinterpreter';
</script>

README

Pinterpreter

What is this?

As the name implies, an interpreter for running puppeteer functions. Instead of writing any code, this takes a "workflow", in pseudo-JSON.

Why was this created?

Puppeteer out of the box requires some other pieces to work efficiently, those other pieces often includes a lot of boiler code or extra libraries that add heft to a project. Pinterpreter aims to be the middle man that consolidates all of them and make puppeteer dead simple to take advantage of.

What does this add?

  • The usage of package-able "workflows" to replace writing code.
  • Simple headless detection avoidance.
  • Cookies saving and loading from '.cookies' file.
  • The ability to use the user's browser instead of the internal one (for easier authentication etc).

Installation

You'll need "npm" for this:

npm i instagram-private-api

Usage

  1. Import "Pinterpreter":
const pinterpreter = require('pinterpreter');
  1. Import your workflow(s):
const { EXAMPLE_WORKFLOW } = require('./path/to/workflow/');
  1. Launch the browser:
const browserController = new pinterpreter.BrowserController();

const browser = await browserController.launch({
    foo: bar,
});

Note: The browser will run in headless mode by default, so it's normal if you don't see anything happening.

  1. Run!
const workflowPerformer = new pinterpreter.WorkflowPerformer();

await workflowPerformer.setBrowserController(browserController);
await workflowPerformer.perform(EXAMPLE_WORKFLOW, {
    foo: bar,
});

  1. Finally, end it:
await browserController.end();

More usages

Refer to the API docs for more information, including how to set up your own workflows and other ways you can launch your browser.