Git Product home page Git Product logo

instagram-interaction-bot's Introduction

Puppeteer Automation

This project demonstrates how to use Puppeteer to perform browser automation tasks using TypeScript. It sets up a reusable browser and page instance with options to specify the executable path and user profile path from environment variables.

Installation

  1. Clone this repository to your local machine.
  2. Navigate to the project directory in your terminal.
  3. Install the required dependencies:
npm install

Usage

  1. Create a .env file in the project root directory and set the following environment variables:

Replace /path/to/your/chrome_or_chromium_binary with the actual path to your Chrome or Chromium binary, and /path/to/your/custom_profile_directory with the path to your custom profile directory (optional).

  1. In your TypeScript files, import the Puppeteer functions as needed:
import { getBrowser, getPage, close } from './puppeteerInstance';

async function doAutomation() {
  const browser = await getBrowser();
  const page = await getPage();

  // Use the browser and page instances to perform your automation tasks
  await page.goto('https://www.example.com');
  // ... Your automation code ...

  // Close the browser when done
  await close();
}

// Call the function
doAutomation();

Run your TypeScript code:

npm run build       # Compiles the TypeScript code to JavaScript
npm start           # Runs the compiled JavaScript code

Configuration In the puppeteerInstance.ts module, you can customize the following options:

executablePath: Set the path to your Chrome/Chromium binary. Defaults to /path/to/your/chrome_or_chromium_binary if not defined in the .env file. userProfilePath: Set the path to your custom profile directory. Defaults to /path/to/your/custom_profile_directory if not defined in the .env file. You can also adjust other Puppeteer options as needed by modifying the puppeteer.launch() function in initPuppeteerInstance().

instagram-interaction-bot's People

Contributors

nnishad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.