Skip to content

nsmle/igramapi

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 2.4.3 to 2.5.0.
- [Release notes](https://github.com/guzzle/psr7/releases)
- [Changelog](https://github.com/guzzle/psr7/blob/2.5/CHANGELOG.md)
- [Commits](guzzle/psr7@2.4.3...2.5.0)

---
updated-dependencies:
- dependency-name: guzzlehttp/psr7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6915bdc

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
December 22, 2022 02:28
app
February 18, 2023 01:56
July 21, 2022 10:13
February 18, 2023 01:56
July 21, 2022 10:13
July 21, 2022 10:13
February 18, 2023 01:56
February 18, 2023 01:56
July 21, 2022 10:13
July 21, 2022 10:13
July 21, 2022 10:13
July 21, 2022 10:13
July 21, 2022 10:13
February 18, 2023 01:56
July 21, 2022 10:13
February 18, 2023 01:56
July 21, 2022 10:13
July 21, 2022 10:13
July 21, 2022 10:13

Igramapi

Igramapi

JWT Compatible Instagram Laravel React TailwindCSS

An unofficial Instagram RESTful API. easy to fetch any feed and interact with Instagram (like, follow, etc.) with JWT token implementation.

Information

If you login with your instagram credentials on /auth/login and get Checkpoint required, please provide IMAP credentials to process authentication error like problem #1 over and over again. Consider using an alternative login with the Instagram sessionid cookie which you can get in this tutorial or this one.

Warning This project uses the nsmle/instagram-user-feed library instead of pgrimaud/instagram-user-feed now onwards. Because some of the features developed and used in this project have not been accepted and I'm still trying to make changes to some of the features that might break.

If you are having trouble with this, you can delete lines 35-60 and replace line 69 to:

"pgrimaud/instagram-user-feed": "^6.16.4"  // Or to a higher version, See: https://github.com/pgrimaud/instagram-user-feed/releases 

in your composer.json file. Or if you have a solution to an existing problem, you can open an issue or make a pull request.

Support ❤️

If you like and find this app useful, please give your support by starring in this repository, or make a donation via Saweria or :

Github-sponsors PayPal

Special Thanks 🙏

A big thank you to Pierre Grimaud for creating a very useful instagram-user-feed library.

Help contribute to solving problems in instagram-user-feed or sponsors to Pierre Grimaud to keep this beloved library alive and well 🙏.

What's next ?

Please take a look at the Igramapi Roadmap to see what features will be implemented next or what fixes are coming.

Installation

git clone https://github.com/nsmle/igramapi.git

Usage

  • Open your terminal and go to your working directory.
  • Clone this repository
    git clone https://github.com/nsmle/igramapi.git
  • Go to folder
    cd igramapi
  • Install dependencies
    composer install
  • Create environment variable
    cp .env.example .env
  • Generate app key inside .env file
    php artisan key:generate
  • Generate JWT_SECRET key in .env file
    php artisan jwt:generate-key
  • Start local server
    php artisan serve
  • Open link http://localhost:8000/ to see available endpoints list

Please see your app BASEURL to see documentations, or you can see https://igramapi.fiki.tech/. Or you can also read the Endpoints bellow.

Endpoints

See your BASEURL and custom your APP_URL in .env file.

Base API Url

<BASEURL>/v1

v1 is semantic version of this application in .env file.

Paths

Method Endpoint Auth
POST /auth/login No
POST /auth/login/alternative No
GET /user Yes
GET /user/{userId} Yes
POST /user/{userId}/follow Yes
POST /user/{userId}/unfollow Yes
GET /reels/{userId} Yes

Note Replace <BASEAPIURL> in example with your app base api url. You can also replace it with https://igramapi.fiki.tech/v1 as an illustration when in production.

You can also send jwt token via cookie/query instead of token header. E.g in Curl:

curl -X <METHOD> "<BASEURL>/<VERSION>/<PATH>"
     -H "Content-Type: <CONTENT_TYPE>"
     -d "<DATA>"
     -b "token=<YOUR_JWT_TOKEN>" 

The jwt token contains the Instagram session id, csrf token cookie and along with some other information.

Login with instagram credentials.

  • ENDPOINT
    /auth/login
    
  • METHOD
    POST
    
  • BODY
    {
        "username" : "YOUR_INSTAGRAM_USERNAME",
        "password" : "YOUR_INSTAGRAM_PASSWORD"
    }
  • EXAMPLE
    curl -X POST "<BASEAPIURL>/auth/login" -H "Content-Type: application/json" -d '{ "username": "YOUR_INSTAGRAM_USERNAME", "password": "YOUR_INSTAGRAM_PASSWORD" }'

Login with instagram cookie session id.

  • ENDPOINT
    /auth/login/alternative
    
  • METHOD
    POST
    
  • BODY
    • Required
      {
          "value"   : "YOUR_INSTAGRAM_SESSIONID_VALUE",
          "expires" : "YOUR_INSTAGRAM_SESSIONID_EXPIRES"
      }
    • Optional
      {
          "name": "sessionid",
          "domain"  : "YOUR_INSTAGRAM_SESSIONID_DOMAIN | .instagram.com",
          "path": "YOUR_INSTAGRAM_SESSIONID_PATH | /",
      }
  • EXAMPLE
    curl -X POST "<BASEAPIURL>/auth/login/alternative" -H "Content-Type: application/json" -d '{ "name": "sessionid", "value": "YOUR_INSTAGRAM_SESSIONID_VALUE", "domain": ".instagram.com", "path": "/", "expires": "YOUR_INSTAGRAM_SESSIONID_EXPIRES" }'

Get logged in user profile.

  • ENDPOINT
    /user
    
  • METHOD
    GET
    
  • EXAMPLE
    curl -X GET "<BASEAPIURL>/user" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"

Get profile by user id or username.

  • ENDPOINT
    /user/{userId|username}
    
  • METHOD
    GET
    
  • EXAMPLE
    curl -X GET "<BASEAPIURL>/user/{userId|username}" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
    

Follow a user.

  • ENDPOINT
    /user/{userId|username}/follow
    
  • METHOD
    POST
    
  • EXAMPLE
    curl -X GET "<BASEAPIURL>/user/{userId|username}/follow" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
    

Unfollow a user.

  • ENDPOINT
    /user/{userId|username}/unfollow
    
  • METHOD
    POST
    
  • EXAMPLE
    curl -X GET "<BASEAPIURL>/user/{userId|username}/unfollow" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"

Get reels of user.

  • ENDPOINT
    • get reels
      /reels/{userId|username}
      
    • get next reels
      /reels/{userId|username}?cursor={maxId}
      
  • METHOD
    GET
    
  • EXAMPLE
    curl -X GET "<BASEAPIURL>/reels/{userId|username}" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"

Contributions

Contributions of any kind welcome!

Feedback

I currently made this project for personal purposes. I decided to share it here to help anyone with the same needs. If you have any feedback to improve it, You found a bug, You need a new feature/endpoint. You can create an issue if needed and feel free to make a suggestion, or open a PR!

License

Licensed under the terms of the MIT License. Following the instagram-user-feed License. Use it wisely and don't abuse it!