npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

instauto2

v2.1.6

Published

Instagram automation library written for Node.js

Downloads

18

Readme

Npm package version Npm package daily downloads Npm package monthly downloads Npm package monthly downloads GitHub license PRs Welcome

instauto2 is an Instagram automation/bot library written in modern, clean javascript using Google's Puppeteer-core. Goal is to be very easy to set up, use, and extend, and obey instagram's limits. Heavily inspired by InstaPy.

Also, this library is a huge upgrade from instauto

Setup

  • First install Node.js.

  • Create a new directory with a file like example.js or example-loki.js

  • Adjust your example.js to your needs. If you want to see how it would work without doing any invasive actions, use the dryRun: true option. Toggle headless to see it in action.

  • Open a terminal in the directory

  • Run npm i

  • Run npm i puppeteer-core instauto2

  • Run node example

You can run this code for example once every day using cron or pm2 or similar

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.

See example.js or example-loki.js for example of features

Data management

The data are stored in json files by default using the file-db.adapter internally. If you need to override the default behavior you can either choose to use the other adapter provided which is using lokijs or you could create your own adapter to pass to instauto.

Creating your own adapter

To create your own adapter you can have a look to loki-db.adapter.ts. Basically you need to create a class that extend the AbstractDbAdapter such as :

export class MyAdapter extends AbstractDbAdapter {
  constructor(private readonly instance: YourInstanceType, private readonly logger: LiteLogger) {
    super();
  }

  addLikedPhoto({ username, href, time }: LikedPhoto): Promise<void> {
    // ... You code goes here ...
  }

  addPrevFollowedUser(follower: Follower): Promise<void> {
    // ... You code goes here ...  
  }

  addPrevUnfollowedUser(unfollower: UnFollower): Promise<void> {
    // ... You code goes here ...
  }

  getFollowedLastTimeUnit(timeUnit: number): Promise<Follower[]> {
    // ... You code goes here ...
  }

  getLikedPhotosLastTimeUnit(timeUnit: number): Promise<LikedPhoto[]> {
    // ... You code goes here ...
  }

  getPrevFollowedUser(username: string): Promise<Follower> {
    // ... You code goes here ...
  }

  getUnfollowedLastTimeUnit(timeUnit: number): Promise<UnFollower[]> {
    // ... You code goes here ...
  }
}

To see how to use you own adapter you can have a look to the example-loki.js

Language

The library support multiple language for logging purpose. The default language is english but you can switch to french or provide your own language.

to change to language using the provided translation see the following example

languageManager.useExistingCustomLanguage('fr');

// or

languageManager.useExistingCustomLanguage('en');

to be able to provide your own translations use the following example

languageManager.setCustomLanguage({
    // The translations goes here
});

Finally, to reset the language to the original one (en), use the following example

languageManager.resetLanguage();

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

See also:

  • https://github.com/GoogleChrome/puppeteer/issues/550
  • https://github.com/GoogleChrome/puppeteer/issues/3774

Also you might want to install the more lightweight package puppeteer-core instead of puppeteer.

Made with ❤️ in 🇫🇷