Git Product home page Git Product logo

salman544 / instagram-video-downloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from riad-azz/instagram-video-downloader

0.0 0.0 0.0 1.91 MB

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

Home Page: https://insta-video-saver.vercel.app/

License: MIT License

Shell 0.15% JavaScript 2.18% TypeScript 96.59% CSS 1.08%

instagram-video-downloader's Introduction

Instagram Videos Downloader

Simple Website/API for downloading instagram videos made with Next.js 13.

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 : insta-video-saver.vercel.app

Website Preview

The frontend includes the following:

  • Dark/Light themes supported.
  • Responsive UI on mobile.
  • Easy and User friendly UI (Interactions feedback and error messages).

Website 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

4. Running Tests:

I am using jest for testing, you can find all the test files in src/__tests__.

# Run all tests
npm run test

# Run a single test
npx jest -t "<test-name>"

# Example
npx jest -t "success-fetchPostJson"

Server API

The Server API is disabled by default but you can enable it by :

  1. Go to src/configs/instagram.ts
  2. Set enableServerAPI to true.

Now you can use the API and integrate this functionality in your other applications.

Endpoint: /api/instagram?url={POST_URL}

Parameters :

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

GET Request example

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

API Response

API response preview

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/configs/upstash.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

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.