GithubHelp home page GithubHelp logo

riad-azz / instagram-video-downloader Goto Github PK

View Code? Open in Web Editor NEW
177.0 6.0 71.0 3.54 MB

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

Home Page: https://instagram-videos.vercel.app

License: MIT License

JavaScript 1.31% CSS 2.47% TypeScript 96.22%
instagram-api instagram-downloader reels-downloader instagram-videos instagram-saver nextjs-13 instagram-scraper nextjs-api server-actions api

instagram-video-downloader's Introduction

Instagram Videos Downloader

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

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

Getting Started

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

instagram-video-downloader's People

Contributors

riad-azz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

instagram-video-downloader's Issues

Some reels does not load.

Describe the bug
When i use your site or the code itself some reels are not available. Some do not have a link to the video, although in fact the reel itself exists and can be downloaded through other services on the Internet. Sometimes the link to the video is incorrect, it gives out 'invalid handle' error.

To Reproduce
Steps to reproduce the behavior:

  1. Go to website
  2. Paste 'https://www.instagram.com/reel/C7A1HIbMsiK/?igsh=MWh1MXVtN292N3EwdA=='
  3. See error
  4. Click on video link and see that reel is not actually 'private'

Expected behavior
I should be able to download all public reels

  • OS: MacOS
  • Browser: Chrome

API JSON

image
Even with the "export const enableServerAPI = true;" it does not bring the result in json anymore

image

Deployed Application is not working

Describe the bug
The Deployed application is not working on this link https://insta-video-saver.vercel.app/

To Reproduce

  1. Go to: https://insta-video-saver.vercel.app/
  2. Paste any Instagram reel link
  3. Click on download Button
  4. See Error

Expected behavior
Application should download the reel video and show the download alert box, after click on download button

Screenshots

Instagram.Video.Downloader.-.Download.Instagram.Videos.Online.mp4

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

This post is private or does not exist False error

Describe the bug
This post is private or does not exist even though the post is valid and can be viewed normally on any account.
such as: This post is private or does not exist

To Reproduce

This happens in the website and the cloned app
Steps to reproduce the behavior:

  1. Sumbit this link https://www.instagram.com/p/Cyy9LKZNYr_/
  2. See error
  3. Open the link on instagram and it works fine

Expected behavior
I expected it to work normally, but the error comes up. It should download it, I dont understand why this happens as i ran over 100 posts and 2 got flagged for this error.

How to install in ubuntu 20

Hi,

I want install this script in ubuntu server but i am facing many issues need apache also
Please guide me.

Thank you

Facebook Version

Everything works like a charm, the Web UI, and API works flawlessly.
Im hoping there will be facebook version in the future. ๐Ÿ˜„

Where is the GraphQL API found?

Hi, I am learning webscraping and just found this awesome project! The code is quite clear and organized and I learnt a lot from it.

Can you share how you discovered the GraphQL API (e.g. the complicated requestData object)?

Thanks again for your great opensource work.

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.