@totallynotdavid/downloader
v1.0.2
Published
Get direct download URLs from YouTube, Instagram, TikTok, X, and more.
Downloads
321
Maintainers
Readme
[pkg]: @totallynotdavid/downloader
Direct URLs from social posts. Skip reverse-engineering and heavy tools. Supports Instagram, TikTok, Twitter/X, YouTube, Reddit, Facebook, Imgur, and Pinterest.
npm install @totallynotdavid/downloaderimport { resolve } from "@totallynotdavid/downloader";
const result = await resolve("https://www.instagram.com/p/ABC123/");result.urls[0].url is the direct media URL. result.urls[0].filename is a
suggested filename. result.meta contains post metadata like author and title.
Some platforms require headers to download. Pass result.headers when fetching:
const response = await fetch(result.urls[0].url, {
headers: result.headers,
});Reference
await resolve(url, {
timeout: 15000,
headers: {
"User-Agent": "...",
},
});Default timeout is 10 seconds.
PlatformNotSupportedError: URL hostname not recognizedNetworkError: request failed (timeout, DNS, HTTP error)ParseError: platform response changed, extractor needs update
import {
resolve,
PlatformNotSupportedError,
NetworkError,
ParseError,
} from "@totallynotdavid/downloader";type MediaResult = {
urls: MediaItem[];
headers: Record<string, string>;
meta: {
title: string;
author: string;
platform: string;
views?: number;
likes?: number;
};
};
type MediaItem = {
type: "image" | "video" | "audio";
url: string;
filename: string;
};
type ResolveOptions = {
timeout?: number;
headers?: Record<string, string>;
};License
MIT
