Socket
Socket
Sign inDemoInstall

fetch-instagram

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fetch-instagram

A lightweight and universal Instagram API client


Version published
Weekly downloads
10
decreased by-28.57%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

fetch-instagram

CircleCI

A lightweight and universal Instagram API client for Node and your browser.

Installation & Usage

Install via npm or yarn:

npm install fetch-instagram --save
# or via yarn
yarn add fetch-instagram

Create an instance with your Instagram access token:

import ig from 'fetch-instagram';

const instagram = ig({
  accessToken: '1234567890.12345ab.1234567890abcdef1234567890abcdef',
});

Simple fetch of your user data and media:

// https://api.instagram.com/v1/users/self
const users = instagram.users();

users.then(res => console.log(res));
// {
//   "data": {
//     "id": "1234567890",
//     "username": "my_user",
//     "profile_picture": "https://scontent.cdninstagram.com/..../file.jpg",
//     "full_name": "My Name",
//     "bio": "My Bio",
//     "website": "https://mysite.com/",
//     "counts": {
//       "media": 143,
//       "follows": 143,
//       "followed_by": 143
//     }
//   },
//   "meta": { "code":200 }
// }

// https://api.instagram.com/v1/users/self/media/recent
const media = instagram.media();
users.then(res => console.log(res));
// {
//   "pagination": {},
//   "data": [
//     {
//       "id":"1234567890123456789_1234567890",
//       "user": { ... },
//       "images": {
//         "thumbnail": { ... },
//         "low_resolution": { ... },
//         "standard_resolution": { ... }
//       },
//       "created_time": "1234567890",
//       "caption": {
//         "id":"12345678901234567890",
//         "text": "My text",
//         "created_time": "1234567890",
//         "from": { ... }
//       },
//       "user_has_liked": false,
//       "likes": { ... },
//       "tags": [ ... ],
//       "filter": "Normal",
//       "comments": { ... },
//       "type": "image",
//       "link": "https://www.instagram.com/p/12345abcdef/",
//       "location": null,
//       "attribution": null,
//       "users_in_photo": [ ... ]
//     },
//     ...
//   ],
//   "meta":{ "code":200 }
// }

API

ig()

import ig from 'fetch-instagram';

ig(options: {
  accessToken: string
});

users()

import { users } from 'fetch-instagram';

users(options: {
  accessToken: string, // Not needed if used as ig().user()
  id: string, // To specify Instagram user-id
});

media()

import { media } from 'fetch-instagram';

media(options: {
  accessToken: string, // Not needed if used as ig().media()
  id: string, // To specify Instagram user-id
  size: number, // Media count limit
  type: 'recent'|'liked', // Media sort order
});

License

Licensed under the MIT License, Copyright © 2017 Glenn Reyes. See LICENSE for more information.

Keywords

FAQs

Last updated on 03 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc