百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

node-instagram

> 安全
开源

用于 Node 的 Instagram API 客户端,支持 promise。

189 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Node 的 Instagram API 客户端,支持 promise。

node-instagram

⚠️ The legacy Instagram API is deprecated and will be disabled on June 29, 2020.

More information https://www.instagram.com/developer.

You should use the new Instagram Graph API.

Instagram api client for node that supports promises and typescript.

You can find examples in the examples directory.

Install

npm install --save node-instagram

yarn add node-instagram

Usage

…

Streaming

This lib have a stream method. It is used to receive new post as events. Streaming can only be used on all endpoints taking MIN_TAG_ID as parameter. Inside it is running setInterval.

javascript
const stream = instagram.stream("tags/:tag-name/media/recent");

stream.on("messages", messages => {
  console.log(messages);
});

// handle stream error
stream.on("error", err => {
  // An error occur
  console.log(err);
});

Server side authentication

Two steps are needed in order to receive an access_token for a user.

  • Get an authentication url from instagram and redirect the user to it
  • Exchange the code for an access_token

You can find a working example with express here.

To see more info about server side authentication take a look at the instagram documentation.

…

Endpoints

To see all endpoint available take a look at instagram developer documentation.

…

It is also possible to send the access_token along as a parameter when you call an endpoint. For example:

javascript
// Get information about current user
instagram.get("users/self", { access_token: accessToken }, (err, data) => {
  console.log(data);
});

// Search for tags by name.
instagram
  .get("tags/search", { access_token: accessToken, q: "paris" })
  .then(data => {
    console.log(data);
  });

Api

const instagram = new Instagram(config)

Create a new Instagram instance

Arguments

  • clientId string
  • accessToken string

instagram.get(endpoint, [params, callback])

Make a GET request on endpoint

Arguments

  • endpoint string
  • params object
  • callback function

instagram.post(endpoint, [params, callback])

Make a POST request on endpoint

Arguments

  • endpoint string
  • params object
  • callback function

instagram.delete(endpoint, [params, callback])

Make a DELETE request on endpoint

Arguments

  • endpoint string
  • params object
  • callback function

instagram.stream(endpoint, params)

Start a fake stream to a endpoint and return new messages found

Arguments

  • endpoint string
  • params object
  • params.interval number interval to run inside default 10000
  • params.runOnCreation boolean run the request when creating object
  • params.minTagId boolean instagram min_tag_id to start request

instagram.getAuthorizationUrl(redirectUri, options)

Get a valid auth url for instagram

Arguments

  • redirectUri string the url to redirect the user with the code
  • options object
  • options.scope array|string the scope to request
  • options.state string optional state
  • callback function

instagram.authorizeUser(code, redirectUri, [callback])

Handle the code returned by instagram an get a user access_token

Arguments

  • redirectUri string code returned by instagram
  • redirectUri string
  • callback function

License

MIT © Léo Pradel

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptapiauthenticationinstagramnodejs

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.