GithubHelp home page GithubHelp logo

maron09 / instagram-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 27 KB

Instagram API is a FastAPI-based application that provides endpoints for user authentication, profile information retrieval, post metrics, and media details. It includes middleware for timeout handling and authentication, ensuring efficient and secure interactions with Instagram data.

Python 100.00%
fastapi instagram instagram-api instagram-metadata instagram-profile-viewer python api-server fastapi-template

instagram-api's Introduction

9ffeb9de-f118-4fc1-8725-5ec2f075bf8e

Instagram API

Overview

Instagram API is a FastAPI-based application that provides various endpoints to interact with Instagram's functionalities, including user authentication, profile information retrieval, post metrics, and media details. The service incorporates middleware for timeout handling and authentication.

Features

  • User Login: Authenticate users using their Instagram credentials.
  • Profile Information: Retrieve profile information for a given username.
  • User Posts: Fetch post metrics for a specified user within optional date ranges.
  • Media Details: Obtain details of a specific media post using its URL.
  • Media Likers: Get the list of users who liked a particular media post.

Endpoints

1. User Login

URL: /v1/api/login
Method: POST
Description: Authenticates a user with their Instagram credentials.

Request Body:

{
  "username": "string",
  "password": "string"
}

Response:

{
  "message": "Login Successful",
  "username": "string"
}

2. Profile Information

URL: /v1/api/profile
Method: GET
Description: Retrieves profile information for a given username.

Query Parameters:

  • username (required): The username of the profile to retrieve.

Response:

{
  "profile_data": { /* Profile information */ }
}

3. User Posts

URL: /v1/api/user_posts
Method: GET
Description: Fetches post metrics for a specified user within optional date ranges.

Query Parameters:

  • username (required): The username to retrieve posts for.
  • from_date (optional): Start date for post retrieval (YYYY-MM-DD).
  • to_date (optional): End date for post retrieval (YYYY-MM-DD).

Response:

{
  "posts": [ /* List of posts */ ]
}

4. Media Details

URL: /v1/api/media
Method: GET
Description: Retrieves details of a specific media post using its URL.

Query Parameters:

  • url (required): The URL of the media to retrieve details for.

Response:

{
  "media_details": { /* Media details */ }
}

5. Media Likers

URL: /v1/api/media_likers
Method: GET
Description: Gets the list of users who liked a particular media post.

Query Parameters:

  • media_id (required): The media ID in the format {post_id}_{owner_id}.
  • username (required): The username of the logged-in user.

Response:

{
  "likers": [ /* List of likers */ ]
}

Middleware

TimeoutMiddleware

Handles request timeouts. The timeout is set to 600 seconds.

AuthenticationMiddleware

Handles authentication using the Instagram service.

Packages Used

This project makes use of several third-party libraries:

  • Instaloader: A tool to download pictures (or videos) along with their captions and other metadata from Instagram.
  • Instagpy: An Instagram automation tool.
  • Instagrapi: A fast and effective Instagram Private API wrapper (compatible with Python 3.7+).

Installation

  1. Clone the repository:
    git clone https://github.com/maron09/instagram-api.git
  2. Navigate to the project directory:
    cd instagram-api
  3. Install the required dependencies:
    pip install -r requirements.txt
  4. Run the application:
    fastapi dev main.py

Usage

Access the API endpoints at http://127.0.0.1:8000. Use tools like curl, Postman, or any HTTP client to interact with the endpoints.

Author

maron09

GitHub: maron09

instagram-api's People

Contributors

maron09 avatar

Watchers

 avatar

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.