Skip to content

A simple and fast tool to download Instagram Reels videos directly to your device. This open-source project provides an easy way to save Instagram Reels content without the need for any third-party apps or complex processes.

License

Notifications You must be signed in to change notification settings

Okramjimmy/Instagram-reels-downloader

Repository files navigation

Instagram Videos Downloader

A simple website/API for downloading Instagram videos, built with Next.js. It works seamlessly and allows you to download videos with no hassle.

Description

This website allows you to easily download Instagram videos in MP4 format. Simply paste the URL of any public Instagram post, and you'll receive the video file. There's also an API that you can integrate into your own applications to download Instagram videos programmatically. The API returns JSON responses with the video URL and other metadata.

Note: Instagram Stories aren't supported.

You can preview and try the website live on Vercel here: instagram-reels-downloader-tau.vercel.app

Getting Started

1. Clone the repository

git clone https://github.com/riad-azz/Instagram-reels-downloader.git

2. Install dependencies

cd Instagram-reels-downloader
npm install

3. Start the server

For development:

npm run dev

For production (build and start):

npm run build
npm run start

4. Docker deployment

Build and run with Docker:

docker build -t instagram-downloader .
docker run -p 3000:3000 instagram-downloader

With environment variables:

docker run -p 3000:3000 -e USE_UPSTASH="true" -e UPSTASH_REDIS_REST_URL="your-url" -e UPSTASH_REDIS_REST_TOKEN="your-token" instagram-downloader

Endpoint: /api/video?postUrl={POST_URL}&enhanced={BOOLEAN}

Parameters:

  • postUrl : Instagram post or reel link (required).
  • enhanced : Return enhanced response format (optional, default: false).

GET Request examples

Standard Response:

curl -i "http://localhost:3000/api/video?postUrl=https://www.instagram.com/reel/DCUBzY0yiKK/"

Enhanced Response:

curl -i "http://localhost:3000/api/video?postUrl=https://www.instagram.com/reel/DCUBzY0yiKK/&enhanced=true"

Standard API Response

{
  "status": "success",
  "data": {
    "filename": "ig-downloader-1712666263.mp4",
    "width": "640",
    "height": "640",
    "videoUrl": "https://scontent.cdninstagram.com/o1/v/t16/f1/m84/E84E5DFC48EA8...etc"
  }
}

Enhanced API Response

{
  "success": true,
  "message": "success",
  "data": {
    "url": "https://www.instagram.com/reel/DCUBzY0yiKK/",
    "source": "instagram",
    "title": "Video caption text...",
    "author": "Author Name",
    "shortcode": "DCUBzY0yiKK",
    "view_count": null,
    "like_count": 41670,
    "thumbnail": "https://scontent.cdninstagram.com/...",
    "duration": 53,
    "owner": {
      "username": "username",
      "profile_pic_url": "https://instagram.fhan17-1.fna.fbcdn.net/...",
      "full_name": "Full Name",
      "is_verified": true,
      "is_private": false
    },
    "medias": [
      {
        "id": "3666432237498452700_4279328167",
        "url": "https://instagram.fhan17-1.fna.fbcdn.net/...",
        "thumbnail": "https://scontent.cdninstagram.com/...",
        "quality": "1080x1920p",
        "resolution": "1080x1920",
        "duration": 53,
        "is_audio": true,
        "type": "video",
        "extension": "mp4"
      }
    ],
    "type": "single",
    "error": false
  },
  "timestamp": "2025-01-21T16:04:32.227Z"
}

Rate Limiter - Upstash

To optimize API performance and reduce the load, rate limiting has been implemented using Upstash. This limits the number of requests to the API within a specific time frame to avoid service disruptions.

To enable rate limiting, follow these steps:

  1. Create an account on upstash.com.
  2. Create a new Redis database.
  3. Click on the newly created database.
  4. Under "REST API", click on .env and copy the provided variables.
  5. Create a .env.local file in the root directory.
  6. Paste the variables into the .env.local file and add the following line:
    USE_UPSTASH="true"
    UPSTASH_REDIS_REST_URL="YOUR-UPSTASH-URL"
    UPSTASH_REDIS_REST_TOKEN="YOUR-UPSTASH-TOKEN"

All rate-limit configurations can be found in src/features/ratelimit/constants.ts.

If you want to change the identifier (default is IP), you can modify it in src/middleware.ts.

License

This project is licensed under the Apache License 2.0. See the LICENSE.md file for details.

About

A simple and fast tool to download Instagram Reels videos directly to your device. This open-source project provides an easy way to save Instagram Reels content without the need for any third-party apps or complex processes.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •