Skip to content

code3-dev/reelflow

Repository files navigation

🎬 reelflow

Elegant and powerful Instagram reels downloader for seamless content extraction.

Note: This library is specifically designed for Instagram Reels. It does not support Stories or Posts.

npm version License: MIT TypeScript Instagram

🚀 Simple Usage

ESM (TypeScript/JavaScript)

// ESM - TypeScript/JavaScript
import { getVideoInfo } from 'reelflow';

async function downloadReel() {
  try {
    const url = 'https://www.instagram.com/reels/CxKp7';
    const video = await getVideoInfo(url);
    console.log(video.videoUrl); // Direct download URL
  } catch (error) {
    console.error('Failed:', error instanceof Error ? error.message : String(error));
  }
}

downloadReel();

CommonJS

// CommonJS
const { getVideoInfo } = require('reelflow');  // Will automatically use the CJS version

async function downloadReel() {
  try {
    const url = 'https://www.instagram.com/reels/CxKp7';
    const video = await getVideoInfo(url);
    console.log(video.videoUrl);
  } catch (error) {
    console.error('Failed:', error.message);
  }
}

downloadReel();

✨ Features

  • 🚀 Lightning-fast video downloads
  • 📝 Full TypeScript support
  • 🛡️ Robust error handling
  • 🔑 No API key required

📦 Installation

npm install reelflow

📖 Documentation

Advanced Usage
import { getVideoInfo, ReelflowError } from 'reelflow';

async function downloadVideo(url: string) {
  try {
    const video = await getVideoInfo(url);
    console.log('URL:', video.videoUrl);
    console.log('Size:', `${video.width}x${video.height}`);
    return video;
  } catch (error) {
    if (error instanceof ReelflowError) {
      console.error(`Failed (${error.status}):`, error.message);
      throw error;
    }
    console.error('Unexpected error:', error instanceof Error ? error.message : String(error));
    throw new ReelflowError('Unexpected error occurred', 500);
  }
}

// Use it
const reelUrl = 'https://www.instagram.com/reels/CxKp7';
downloadVideo(reelUrl).catch(console.error);
Error Handling
import { getVideoInfo, ReelflowError } from 'reelflow';

async function handleReelDownload() {
  try {
    const url = 'https://www.instagram.com/reel/CxKp7';
    const video = await getVideoInfo(url);
    return video;
  } catch (error) {
    if (error instanceof ReelflowError) {
      switch (error.status) {
        case 400: console.error('Invalid URL format'); break;
        case 401: console.error('Video is not accessible'); break;
        case 404: console.error('Video not found'); break;
        default: console.error(`Error ${error.status}:`, error.message);
      }
      throw error;
    }
    console.error('Unexpected error:', error instanceof Error ? error.message : String(error));
    throw new ReelflowError('Unexpected error occurred', 500);
  }
}

handleReelDownload().catch(console.error);

📞 Support

📄 License

MIT © Hossein Pira


Made with ❤️ by Hossein Pira

About

Elegant and powerful Instagram reels downloader for seamless content extraction.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published