npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

socialmediadl

v1.0.1

Published

Universal social media downloader API

Readme

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:

| Function | Platform | Example URL | |----------|----------|-------------| | fetchBlueskyData(url) | Bluesky | https://bsky.app/... | | fetchCapcutData(url) | CapCut | https://capcut.com/... | | fetchDailymotionData(url) | Dailymotion | https://dailymotion.com/... | | fetchDouyinData(url) | Douyin | https://douyin.com/... | | fetchMetaData(url) | Facebook/Instagram | https://instagram.com/p/... | | fetchKuaishouData(url) | Kuaishou | https://kuaishou.com/... | | fetchLinkedinData(url) | LinkedIn | https://linkedin.com/... | | fetchPinterestMedia(url) | Pinterest | https://pinterest.com/pin/... | | fetchRedditData(url) | Reddit | https://reddit.com/r/... | | fetchSnapchatData(url) | Snapchat | https://snapchat.com/... | | fetchSoundcloudData(url) | Soundcloud | https://soundcloud.com/... | | fetchSpotify(url) | Spotify | https://spotify.com/track/... | | fetchThreadsData(url) | Threads | https://threads.net/... | | fetchTiktokData(url) | TikTok | https://tiktok.com/@user/video/... | | fetchTumblrData(url) | Tumblr | https://tumblr.com/... | | fetchTwitterData(url) | Twitter/X | https://twitter.com/user/status/... | | fetchYoutubeData(url) | YouTube | https://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