A simple website/API for downloading Instagram videos, built with Next.js. It works seamlessly and allows you to download videos with no hassle.
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
git clone https://github.com/riad-azz/Instagram-reels-downloader.git
cd Instagram-reels-downloader
npm install
For development:
npm run dev
For production (build and start):
npm run build
npm run start
Parameters:
postUrl
: Instagram post or reel link (required).
curl -i "http://localhost:3000/api/video?postUrl=https://www.instagram.com/reel/DCUBzY0yiKK/"
{
"status": "success",
"data": {
"filename": "ig-downloader-1712666263.mp4",
"width": "640",
"height": "640",
"videoUrl": "https://scontent.cdninstagram.com/o1/v/t16/f1/m84/E84E5DFC48EA8...etc"
}
}
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:
- Create an account on upstash.com.
- Create a new Redis database.
- Click on the newly created database.
- Under "REST API", click on
.env
and copy the provided variables. - Create a
.env.local
file in the root directory. - 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
.
This project is licensed under the Apache License 2.0. See the LICENSE.md file for details.