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.gitcd Instagram-reels-downloader
npm installFor development:
npm run devFor production (build and start):
npm run build
npm run startBuild and run with Docker:
docker build -t instagram-downloader .
docker run -p 3000:3000 instagram-downloaderWith 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-downloaderParameters:
postUrl: Instagram post or reel link (required).enhanced: Return enhanced response format (optional, default: false).
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"{
"status": "success",
"data": {
"filename": "ig-downloader-1712666263.mp4",
"width": "640",
"height": "640",
"videoUrl": "https://scontent.cdninstagram.com/o1/v/t16/f1/m84/E84E5DFC48EA8...etc"
}
}{
"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"
}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
.envand copy the provided variables. - Create a
.env.localfile in the root directory. - Paste the variables into the
.env.localfile 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.