Skip to content

Repository files navigation

InstaCoffee

InstaCoffee Logo

An Instagram automation/bot library (API) written in Typescript/Deno using Google's Puppeteer. Goal is to be very easy to set up, use, and extend, and obey instagram's limits. Forked from https://github.com/mifi/instauto. Big thanks for contributions and making this project open source.

Setup

The application works properly only with the Google Chrome browser.

Deno

  1. Install Deno by following the instructions on deno.land.
  2. Clone the repository:
git clone https://github.com/wozniak-slawomir/insta-coffee.git
cd insta-coffee
  1. Install the required dependencies:
deno install --allow-scripts
  1. Make sure to fill .env file with proper values and all paths are correctly set for your operating system. It is specifically about CHROME_PATH, APP_BASE_PATH. The default browser path on Windows is: C:\Program Files\Google\Chrome\Application\chrome.exe, and on Linux /usr/bin/google-chrome-stable.
  2. Run the app:
deno run -A ./src/entry.ts

Docker Compose

For Windows operating system, you must additionally install WSL according to the instructions on the website. Install WSL

  1. Ensure you have Docker and Docker Compose installed. Follow the instructions on docker.com if needed.
  2. Clone the repository:
git clone https://github.com/wozniak-slawomir/insta-coffee.git
cd insta-coffee
  1. Start the service:
docker compose up

Tip: If you are having trouble setting up a container in Docker, first stop containers and remove containers, networks, volumes and images created by docker:

docker compose down -v

and try restarting the service by adding the --build and --force-recreate flags. The -v flag should be used as a last resort, as it removes data from volumes.

docker compose up --build --force-recreate

.env

Set the environment variables according to the .env.example file (leaving the .env file name).

DRY_RUN=

If set, will not do any actions. The application will work, but it will not perform any action on the user, such as liking a profile, photo, etc.

TAKE_SCREENSHOTS=

If set, will take browser screenshots in case of application errors.

MY_EMAIL=

E-mail of the app admin. It will appear as "reply to:" label.

MAIL_HOST=

E-mail delivery network address.

MAIL_PASSWORD=

Your e-mail password.

MAILSERVER_PORT=

Port to e-mail server.

CHROME_PATH=

Path to the Google Chrome app on your computer.

MAILSERVER_HOST=

E-mail server host to communicate with front-end.

SENDER_EMAIL=

This will be visible as the sender of the email.

APP_BASE_PATH=

Path to the application.

RUN_IMMEDIATELY=

If set true, the application will launch immediately. Otherwise, the application will run according to the cron's settings in the file entry.ts.

SMS_API_TOKEN=

API token for sending SMS alerts.

SMS_RECEIVER=

Phone number for receiving SMS alerts.

DONT_REMOVE_SENSITIVE_DATA=

If set, will NOT remove sensitive data, used for debugging

SKIP_AI=

If set, will skip AI processing

Tip: Be sure to set your file paths correctly. This is very important for the proper operation of the application.

users.json

Set the variables according to the example.users.json file (leaving the users.json file name).

"username":

Username in the Instagram app.

"password":

Instagram account password. The password will be removed during runtime for security.

"maxFollowsPerHour":
"maxFollowsPerDay":

The maximum number of user follows per hour/day.

"maxLikesPerDay":

The maximum number of photos likes per day.

"followUserRatioMin":
"followUserRatioMax":

The minimum/maximum ratio of followers. It allows you to limit following too famous people or empty accounts.

"usersToFollow":

A list of accounts where we check followers and interact with them.

"followersBatchAmount":

A variable that determines the amount of data downloaded.

"emailToNotify":

E-mail to which the results of the application will be sent.

"message":

Message sent to the user who reacted to our action.

Supported functionality

  • Follow the followers of some particular users. (e.g. celebrities.) Parameters like max/min ratio for followers/following can be set.

  • Unfollow users that don't follow us back. Will not unfollow any users that we recently followed.

  • Unfollow auto followed users (also those following us back) after a certain number of days.

  • The code automatically prevents breaching 100 follow/unfollows per hour or 700 per 24hr, to prevent bans. This can be configured.

Debugging

If you want to debug the application by viewing its performance in a live browser, you must change the headless parameter to false in the browser.ts file.

There is no way to run the app in a live browser in docker.

Tip: First make sure that the path to the browser file is correctly specified.

this.browser = await puppeteer.launch({headless: false});

If you have problems with debugging, use the Puppeteer documentation. Puppeteer debugging documentation

Tips

  • Run this on a machine with a non-cloud IP to avoid being banned

Troubleshooting

  • If it doesn't work, make sure your instagram language is set to english
  • If you get a lot of problems “navigation time exceeded - timeout 30000ms”, check the code or increase the resources in docker-compose.yaml in limits

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages