🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more
Socket
Book a DemoInstallSign in
Socket

socialmediadl

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socialmediadl

Universal social media downloader API

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

socialmediadl

npm version GitHub stars GitHub forks

A universal social media downloader package for Node.js.
Download media from 17+ platforms including LinkedIn, Threads, Reddit, Facebook, Instagram, TikTok, YouTube, Pinterest, Twitter, and more — with auto-detection and easy-to-use API.

⭐ Star History

Star History Chart

✨ Features

  • Auto-Detection: Automatically detects platform from URL
  • 17+ Platforms Supported:
    • Bluesky
    • CapCut
    • Dailymotion
    • Douyin
    • Facebook & Instagram
    • Kuaishou
    • LinkedIn
    • Pinterest
    • Reddit
    • Snapchat
    • Soundcloud
    • Spotify
    • Threads
    • TikTok
    • Tumblr
    • Twitter (X)
    • YouTube
  • Smart Redirect Handling: Handles YouTube and other platform redirects seamlessly
  • Easy Integration: Simple function-based API
  • TypeScript Ready: Works seamlessly with TypeScript projects

🚀 Installation

npm install socialmediadl

Or with yarn:

yarn add socialmediadl

Or with pnpm:

pnpm add socialmediadl

📖 Usage

Basic Usage (Auto-Detection)

The easiest way to use socialmediadl is with the auto-detection feature:

const socialmediadl = require('socialmediadl');

async function downloadMedia() {
  try {
    // Auto-detect platform and download
    const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
    const result = await socialmediadl.download(url);

    console.log('Platform:', result.platform); // 'youtube'
    console.log('Data:', result.data); // Media download info
  } catch (error) {
    console.error('Error:', error.message);
  }
}

downloadMedia();

Response Format:

{
  platform: 'youtube',  // Detected platform name
  data: {
    // Platform-specific media download information
    // (varies by platform)
  }
}

Platform-Specific Downloads

For more control, use platform-specific functions:

const { 
  fetchYoutubeData,
  fetchTiktokData,
  fetchMetaData,
  fetchTwitterData 
} = require('socialmediadl');

async function examples() {
  // YouTube
  const youtubeData = await fetchYoutubeData('https://youtube.com/watch?v=...');

  // TikTok
  const tiktokData = await fetchTiktokData('https://tiktok.com/@user/video/...');

  // Facebook/Instagram
  const metaData = await fetchMetaData('https://instagram.com/p/...');

  // Twitter/X
  const twitterData = await fetchTwitterData('https://twitter.com/user/status/...');
}

Error Handling

Always wrap your calls in try-catch blocks:

const socialmediadl = require('socialmediadl');

async function safeDownload(url) {
  try {
    const result = await socialmediadl.download(url);
    return result;
  } catch (error) {
    if (error.message.includes('not supported')) {
      console.error('Platform not supported:', url);
    } else {
      console.error('Download error:', error.message);
    }
    return null;
  }
}

🔗 API Reference

Main Function

socialmediadl.download(url)

Auto-detects platform and downloads media.

Parameters:

  • url (string): The social media URL

Returns:

Promise<{
  platform: string,  // Detected platform name
  data: object      // Media download information
}>

Throws:

  • Error if URL is missing
  • Error if platform is not supported

Platform-Specific Functions

All platform functions return a Promise with platform-specific data:

FunctionPlatformExample URL
fetchBlueskyData(url)Blueskyhttps://bsky.app/...
fetchCapcutData(url)CapCuthttps://capcut.com/...
fetchDailymotionData(url)Dailymotionhttps://dailymotion.com/...
fetchDouyinData(url)Douyinhttps://douyin.com/...
fetchMetaData(url)Facebook/Instagramhttps://instagram.com/p/...
fetchKuaishouData(url)Kuaishouhttps://kuaishou.com/...
fetchLinkedinData(url)LinkedInhttps://linkedin.com/...
fetchPinterestMedia(url)Pinteresthttps://pinterest.com/pin/...
fetchRedditData(url)Reddithttps://reddit.com/r/...
fetchSnapchatData(url)Snapchathttps://snapchat.com/...
fetchSoundcloudData(url)Soundcloudhttps://soundcloud.com/...
fetchSpotify(url)Spotifyhttps://spotify.com/track/...
fetchThreadsData(url)Threadshttps://threads.net/...
fetchTiktokData(url)TikTokhttps://tiktok.com/@user/video/...
fetchTumblrData(url)Tumblrhttps://tumblr.com/...
fetchTwitterData(url)Twitter/Xhttps://twitter.com/user/status/...
fetchYoutubeData(url)YouTubehttps://youtube.com/watch?v=...

Example:

const { fetchYoutubeData } = require('socialmediadl');

const data = await fetchYoutubeData('https://youtube.com/watch?v=...');
console.log(data);

📦 Available Exports

const socialmediadl = require('socialmediadl');

// Main function
socialmediadl.download(url)

// All platform-specific functions
const {
  fetchBlueskyData,
  fetchCapcutData,
  fetchDailymotionData,
  fetchDouyinData,
  fetchMetaData,
  fetchKuaishouData,
  fetchLinkedinData,
  fetchPinterestMedia,
  fetchRedditData,
  fetchSnapchatData,
  fetchSoundcloudData,
  fetchSpotify,
  fetchThreadsData,
  fetchTiktokData,
  fetchTumblrData,
  fetchTwitterData,
  fetchYoutubeData
} = socialmediadl;

🛠️ Technical Details

  • Smart URL Detection: Automatically identifies platform from URL patterns
  • Enhanced Axios Configuration: Handles redirects from YouTube and other platforms
  • Modular Architecture: Each platform has its own service module
  • Error Handling: Comprehensive error handling with meaningful messages
  • No Server Required: Pure module package, no HTTP server needed

🏗️ Project Structure

.
├── config/            # Configuration files (axios setup)
├── services/          # Platform-specific downloader functions
├── index.js           # Main module exports
├── test.js            # Example test file
├── package.json       # Package metadata
└── README.md          # Documentation

🧪 Testing

Run the included test file to see examples:

node test.js

Or create your own test:

const socialmediadl = require('socialmediadl');

async function myTest() {
  const result = await socialmediadl.download('YOUR_URL_HERE');
  console.log(result);
}

myTest();

🤝 Contributing

Contributions are welcome! Feel free to:

  • Open issues for bugs or feature requests
  • Submit pull requests for improvements
  • Add support for new platforms

👨‍💻 Author

ST | Sheikh Tamim
GitHub: @sheikhtamimlover
Repository: socialmediadl

📝 License

This project is open source and available for use.

🌟 Show Your Support

If you find this package useful, please consider giving it a ⭐ on GitHub!

GitHub stars

FAQs

Package last updated on 10 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts