An unofficial Node.js package to download media from Facebook, Instagram, and TikTok using SnapSave API.
- π₯ Download videos and images from:
- Facebook posts, reels, and watch videos
- Instagram posts and reels
- TikTok videos
- π± Support for multiple quality options (when available)
- π URL normalization and validation
- π Automatic platform detection
npm install snapsaver-downloader
Or with yarn:
yarn add snapsaver-downloader
import { SnapSaver } from 'snapsaver-downloader'; // Example: Download from Facebook async function downloadMedia() { try { const result = await SnapSaver('https://www.facebook.com/watch/?v=1377532133417378'); if (result.success) { console.log('Media found:', result.data); // Access download URLs: const mediaUrls = result.data?.media?.map(item => item.url); console.log('Download URLs:', mediaUrls); } else { console.error('Error:', result.message); } } catch (error) { console.error('Failed to download:', error); } } downloadMedia();
The package supports various URL formats:
https://www.facebook.com/watch/?v=1234567890https://www.facebook.com/share/v/123ABC456/https://www.facebook.com/username/videos/1234567890https://fb.watch/abcdef123/
https://www.instagram.com/p/ABC123def/https://www.instagram.com/reel/ABC123def/- URLs with query parameters (e.g.,
?utm_source=ig_web_copy_link)
https://www.tiktok.com/@username/video/1234567890https://vt.tiktok.com/ABCDEF/
The main function to download media from supported social platforms.
url(string): URL of the social media post to download
Returns a Promise that resolves to a SnapSaveDownloaderResponse object:
interface SnapSaveDownloaderResponse { success: boolean; message?: string; data?: SnapSaveDownloaderData; } interface SnapSaveDownloaderData { description?: string; preview?: string; media?: SnapSaveDownloaderMedia[]; } interface SnapSaveDownloaderMedia { resolution?: string; shouldRender?: boolean; thumbnail?: string; type?: "image" | "video"; url?: string; }
success- Boolean indicating if the download was successfulmessage- Error message (only present whensuccessis false)data- Result data (only present whensuccessis true)description- Description of the post (when available)preview- Preview image URL (when available)media- Array of media objects containing:type- Media type ("video" or "image")url- Direct download URLresolution- Resolution (for videos, when available)thumbnail- Thumbnail URL (for videos, when available)shouldRender- Whether the media needs special rendering
The package exports several utility functions that might be useful:
import { normalizeURL, detectPlatformFromURL, fixThumbnail } from 'snapsaver-downloader/dist/utils'; // Normalize a URL (add www if missing) const normalizedUrl = normalizeURL('https://facebook.com/video/123'); // Result: 'https://www.facebook.com/video/123' // Detect platform from URL const platform = detectPlatformFromURL('https://www.instagram.com/reel/ABC123/'); // Result: 'Instagram'
- This package relies on the SnapSave.app service, which may change its API without notice
- Some platforms may block scraping attempts or change their URL structure
- For high-volume applications, consider implementing rate limiting
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This package is not affiliated with, endorsed by, or connected to SnapSave.app or any of the social media platforms it supports. It is provided for educational purposes only. Always respect the terms of service of the platforms you are downloading content from, and ensure you have the right to download and use the content.