Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

totallynotdavid/downloader

Repository files navigation

[pkg]: @totallynotdavid/downloader

NPM Version codecov

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/downloader
import { 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

Options
await resolve(url, {
 timeout: 15000,
 headers: {
 "User-Agent": "...",
 },
});

Default timeout is 10 seconds.

Errors
  • PlatformNotSupportedError: URL hostname not recognized
  • NetworkError: request failed (timeout, DNS, HTTP error)
  • ParseError: platform response changed, extractor needs update
import {
 resolve,
 PlatformNotSupportedError,
 NetworkError,
 ParseError,
} from "@totallynotdavid/downloader";
Types
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

About

Get direct download URLs from YouTube, Instagram, TikTok, X, and more.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Contributors 3

AltStyle によって変換されたページ (->オリジナル) /