GithubHelp home page GithubHelp logo

glennreyes / fetch-instagram Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 2.0 469 KB

๐Ÿ“ธ A lightweight and universal Instagram API client

License: MIT License

JavaScript 100.00%
instagram instagram-api fetch api promise node browser universal isomorphic

fetch-instagram's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.