Skip to content

Simple website made with Next.js for downloading instagram videos with an API that can be used to integrate it in other applications.

License

Notifications You must be signed in to change notification settings

riad-azz/instagram-video-downloader

Repository files navigation

Instagram Videos Downloader

Simple Website/API for downloading instagram videos made with Next.js that actually works with no problem.

Note

The website preview has been shut down due to exceeding the free usage limit on Vercel with more than 2,000,000 visits for the past week. Since I don't make any money from this website, I had to close it.

image

Description

A website that lets you download Instagram videos easily and quickly. You can paste the URL of any public Instagram post and get the video file in MP4 format. there is also an API that you can use to integrate this functionality into your own applications. The API is simple, and it returns JSON responses with the video URL and other metadata.

Note: Instagram stories aren't supported.

You can preview and try the website live in Vercel here : instagram-videos.vercel.app

Website Preview

Easy and User friendly UI (Interactions feedback and error messages).

Desktop preview

Responsive on mobile and small devices.

Mobile preview

Running using docker

1. Clone the repository:

git clone https://github.com/riad-azz/instagram-video-downloader.git

2. Build the Docker image:

docker build -t instagram-video-downloader .

3. Run the Docker container:

docker run -p 3000:3000 instagram-video-downloader

Running using node

1. Cloning the repository:

git clone https://github.com/riad-azz/instagram-video-downloader.git

2. Installing dependencies:

cd instagram-video-downloader
npm install

3. Starting the server:

# Development
npm run dev

# Build
npm run build

# Start
npm run start

Endpoint: /api/video?postUrl={POST_URL}

Parameters :

  • postUrl : Instagram Post or Reel link (required).

GET Request example

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

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"
    }
}

Rate Limiter - Upstash

In order to reduce the load on the API and ensure optimal performance, I have implemented rate limiting using Upstash. This integration allows me to restrict the number of requests made to the API within a specified time frame, preventing excessive traffic and potential service disruptions.

To enable this feature follow these steps:

  1. Create an account on upstash.com.
  2. Create a new Redis database.
  3. Click on the newly created database.
  4. Scroll down to REST API, click on .env and copy the two variables provided.
  5. Create a new .env.local file in the root directory.
  6. Paste what you copied inside and add USE_UPSTASH and set it to true.

Here is what your .env.local should look like:

# ...other variables
USE_UPSTASH="true"
UPSTASH_REDIS_REST_URL="YOUR-UPSTASH-URL"
UPSTASH_REDIS_REST_TOKEN="YOUR-UPSTASH-TOKEN"

All ratelimit configs can be found in src/features/ratelimit/constants.ts.

If you would like to change the identifier (default is IP) you can change it in src/middleware.ts.

License

This project is licensed under the [MIT] License - see the LICENSE.md file for details