Giter Club home page Giter Club logo

nsmle / igramavel Goto Github PK

View Code? Open in Web Editor NEW
35.0 2.0 6.0 1.38 MB

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

Home Page: https://igramavel.fiki.tech/v1

License: MIT License

PHP 85.87% JavaScript 0.22% Blade 13.91%
instagram instagram-api instagram-bot instagram-bot-api instagram-client instagram-crawler instagram-downloader instagram-feed instagram-post instagram-private

igramavel's Introduction

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!

igramavel's People

Contributors

dependabot[bot] avatar nsmle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

igramavel's Issues

Tried to login but got Checkpoint Required

When i try to login using my new instagram account. it says "Checkpoint required, please provide IMAP credentials to process authentication" how to solve this problem?

Follow user

Follow user

This feature must be accessible by request below

  • Endpoint
    /user/{userId/username}/follow
    
  • Method
    POST
    
  • Header
    Authorization: Bearer {token}
    

Login with instagram credentials

This feature must be accessible by request below

  • Endpoint
    /api/auth/login
    
  • Method
    POST
    
  • Body
    {
        "username" : "INSTAGRAM_USERNAME",
        "password" : "INSTAGRAM_PASSWORD"
    }

Account suspended for 1 day

Im not sure im doing something wrong but 2 account suspended for 1 day.
Im using token and only tried "/api/profile"
after 5-6 request account suspended.

UnFollow user

Unfollow user

This feature must be accessible by request below

  • Endpoint
    /user/{userId/username}/unfollow
    
  • Method
    POST
    
  • Header
    Authorization: Bearer {token}
    

Get reels

Add feature to get Reels of user

This feature must be accessible by request below

  • Endpoint
    • get reels
      /api/reels/{userId/username}
      
    • get next reels
      /api/reels/{userId/username}?cursor={endCursor/maxId}
      
  • Method
    GET
    
  • Header
    Authorization: Bearer {token}
    

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.