0.2.0 • Published 2 years ago

instagram-dynamic-profile v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

instagram-dynamic-profile library

logo

npm npm


This library uses the instagram-private-api to automate dynamic updates to an Instagram profile such as cycling through profile pictures every 30 seconds.

Note: the default refresh interval is set to 30000ms (30 seconds) for most dynamic tasks. If this interval is set below 20 seconds, there is a chance Instagrams API will block requests if more than 200 are made within an hour.


Table of Contents

Install

From npm

npm install instagram-dynamic-profile

From github

npm install github:noodleofdeath/instagram-dynamic-profile

This package uses url-regex-safe (GitHub) to check for links when sending direct messages. By default, the safe regex engine re2 is not installed. ⚠ It's highly recommended for you to install re2 by running npm install re2, else you will be vulnerable to CVE-2020-7661.

Support us

If you find this library useful for you, you can support it by donating any amount

BTC: 3HNXnygb1HowTBbvhQrQ4vxekfQ2UM83sd

SHIB: 0xBb8f7EbF3D7f54BAcadece3dada9ab2358C90635

ETH: 0xec78f794489D511137770Ae144A550B50c2AFF92

Examples

You can find usage examples here.

Be sure to create a .env file in your project root with your Instagram credentials and match the format of .env.example. In most cases you will also need to run the following inside the project/example directory.

npm i dotenv

Note for JavaScript users: As of Node v.13.5.0, there isn't support for ESModules and the 'import'-syntax. So you have to read the imports in the examples like this:

import { A } from 'b'const { A } = require('b')

Cycling Profile Picture

// Import modules
import 'dotenv/config';
import { resolve } from 'path';
import { IgDPCycleProfilePictureTask, IgDPSession } from 'instagram-dynamic-profile';

// Cycle profile picture with images found in `./img` every 30 seconds.
const session = new IgDPSession({
  username: process.env.IG_USERNAME as string,
  password: process.env.IG_PASSWORD as string,
  tasks: [new IgDPCycleProfilePictureTask(resolve('./img'))],
});

session.start();

Cycling Biography

// Import modules
import 'dotenv/config';
import { resolve } from 'path';
import { IgDPCycleBioTask, IgDPSession } from 'instagram-dynamic-profile';

// Dynamically update the profile bio  every 30 seconds to have the most recent
// timestamp in the last 30 seconds.
const session = new IgDPSession({
  username: process.env.IG_USERNAME as string,
  password: process.env.IG_PASSWORD as string,
  tasks: [
    new IgDPCycleBioTask((): string => {
      return `Today's timestamp is:\n${new Date()}`;
    }),
  ],
});

session.start();

Debugging

In order to get debug infos provided by the library, you can enable debugging. The prefix for this library is ig. To get all debug logs (recommended) set the namespace to ig:*.

Node

In Node you only have to set the environment variable DEBUG to the desired namespace. Further information

Contribution

If you need features that is not implemented - feel free to implement and create PRs!

Plus we need some documentation, so if you are good in it - you are welcome.

Setting up your environment is described here.

Useful links

instagram-id-to-url-segment - convert the image url fragment to the media ID

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago