## SOCIAL MEDIA SCRAPPER ⚉
> brought to you by CRYSNOVA_AI

# social-dl — The last downloader you'll ever need

Direct social-media downloader for YouTube, TikTok, Facebook, Instagram, Twitter/X, Pinterest, CapCut, RedNote/Xiaohongshu, Threads, Bilibili, Apple Music, Audiomack, DramaBox, GoodShort, FlexTV, MoboReels, ReelShort, ShortMax, FlickReels, AnyDrama, DramaFren, SaveTube, Spotify, and Thenkiri links. Verified public episode URLs from ReelShort, GoodShort, ShortMax, and FlickReels can resolve through AnyDrama's public episode resolver; social-dl preserves the original provider label and URL. Other short-drama providers keep their native adapters where available.

[![npm](https://img.shields.io/npm/v/social-dl)](https://www.npmjs.com/package/social-dl) [![License](https://img.shields.io/badge/license-proprietary-red)](./LICENSE) [![Node](https://img.shields.io/badge/node-%3E%3D18-green)](https://nodejs.org/)

![social-dl direct media downloader](https://cdn.crysnova.qzz.io/files/1790612783695-28bb146a-6d45-4d09-8255-def439edb896.jpeg)

## NEW: v1.5 feature set

The following features are new in the current development line. They are designed as additive layers around the existing resolver and saver, so the original single-URL commands continue to work unchanged.

### NEW: Batch downloads and resumable queues

Download several URLs with bounded concurrency. Input files accept one URL per line; blank lines and lines beginning with `#` are ignored.

```bash
npx social-dl --file links.txt --workers 3 --archive downloads.txt --skip-existing --output-dir downloads
npx social-dl URL1 URL2 URL3 --workers 2 --output-dir downloads
```

For a queue that persists between runs, use the queue commands. Queue state is stored as an atomically replaced JSON file, and failed items can be retried without adding them again.

```bash
npx social-dl queue add URL1 URL2 --queue-file downloads.queue.json
npx social-dl queue list --queue-file downloads.queue.json
npx social-dl queue run --workers 3 --output-dir downloads --queue-file downloads.queue.json
npx social-dl queue retry-failed --workers 2 --queue-file downloads.queue.json
```

### NEW: Organized output, metadata, thumbnails, and subtitles

Use templates to organize files with `{platform}`, `{creator}`, `{author}`, `{title}`, `{id}`, `{episode}`, and `{ext}` placeholders. Metadata is written beside the media as `.info.json`; `--thumbnail` additionally saves the provider thumbnail when one is available.

```bash
npx social-dl URL --template '{platform}/{creator}/{title} [{id}].{ext}' --metadata --thumbnail
npx social-dl URL --subtitles --subtitle-lang en
```

Subtitle export only writes tracks that the provider publicly exposes. social-dl does not invent, decrypt, or bypass subtitle and media access controls.

### NEW: Public series and catalog discovery

Inspect episode links visible on a public series page. Results include episode number, title, URL, lock state, and whether the item appears downloadable.

```bash
npx social-dl series "https://www.goodshort.com/drama/example-12345"
```

Catalog discovery now includes Bilibili, DramaBox, GoodShort, FlexTV, MoboReels, ReelShort, DramaFren, AnyDrama, ShortMax, FlickReels, and region-specific public JustWatch pages. Catalog results normalize title, cover, episode, lock state, official URL, and source order.

```bash
npx social-dl catalog dramafren --category latest --lan en
npx social-dl catalog anydrama --query "billionaire husband" --lan en
npx social-dl catalog flickreels --query "pregnant queen"
npx social-dl catalog bilibili --category ranking
npx social-dl catalog bilibili --query "地球便当"
npx social-dl catalog justwatch --country GB --provider justwatch-tv-beta
npx social-dl catalog justwatch --provider "https://www.justwatch.com/us/provider/hulu"
npx social-dl catalog justwatch --country CA --query "Dune"

# Crawl public Thenkiri search pages and resolve every unlocked listed source.
# This prints JSON links/statuses and does not download media bodies.
npx social-dl thenkiri search-resolve "The Originals" --max-pages 25 --delay-ms 350
```

JustWatch catalog pages and title URLs are country-specific. `--country` accepts a two-letter region code and defaults to `US`; use it for catalog searches or a provider slug, such as `justwatch-tv-beta`. When `--provider` is a full provider URL, its country must match `--country`. A catalog response reports the country and provider slug used. Region-specific pages may differ or omit titles; selecting a country does not guarantee that an offer is available there. JustWatch describes its TV Free/TV Beta availability as region-dependent in its [support guidance](https://support.justwatch.com/article/how-to-watch-movies-and-tv-shows-for-free-on-justwatch).

Title metadata is read from public JustWatch page markup. It includes available title, description, artwork, release year, genres, and any seasons/episodes or provider names present in the public structured metadata. Episode lists and provider offers can be absent; this is metadata discovery, not an episode-link generator.

`justwatchDetails()` returns catalog offers separately from playable media. Each offer preserves its provider, region, access label, episode/season/title scope, official provider destination when available, and the JustWatch clickout URL. Offer records use `sourceKind: "catalog-offer"`, set `downloadable: false`, and never put a provider landing page in a media format.

Use `justwatchWatch()` when an application should open a provider destination instead of downloading. It returns a `watchUrl` plus `providerWatchUrl` (which is `null` if JustWatch only exposes its clickout), and separately retains `justwatchClickoutUrl`. Its `sourceKind` is `"provider-watch"`, its formats are empty, and `downloadable` is always false. The result identifies the provider platform as the playback location, but sets `browserPlaybackStatus` to `"not-verified-by-resolver"`; it does not claim that the provider page will successfully play in every browser or region. The provider may require its own app, account, ads, or regional access.

No JustWatch media stream or download resolver is currently supported. The earlier public TV Free/Beta HLS association path has been removed: a public or signed manifest is not proof of permission, intended third-party use, or ad preservation. `justwatchDl()` and `justwatchSave()` remain exported for API compatibility, but reject listed offers with `UnsupportedError`; they do not request provider player pages for media, extract manifests, or create/overwrite output files. A missing title or offer remains `NotFoundError`. This preserves the distinction between a catalog offer, an official provider watch link, a stream source, and a downloadable source.

```bash
# Find the title in a region-specific JustWatch catalog.
npx social-dl catalog justwatch --country US --query Merlin
```

Use a region-matching title URL and offer scope. Provider offers may be episode-, season-, or title-scoped; do not infer an episode-specific route from a season offer. `justwatchWatch()` returns only an official provider destination or JustWatch clickout. Browser playback is not verified. The provider may require its own app/account, display ads, or enforce regional access. `--country` must match the country in the URL; do not use another region’s page to evade restrictions.

Library consumers can search, inspect the episode and offers, then explicitly open an official provider route:

```js
import { catalogSearch, justwatchDetails, justwatchWatch } from 'social-dl';

const search = await catalogSearch('justwatch', 'Merlin', { country: 'US' });
const title = search.items.find(item => item.url === 'https://www.justwatch.com/us/tv-show/merlin'); // 2008 series, not Merlin (1998)
if (!title) throw new Error('The Merlin (2008) listing was not returned.');
const titleUrl = `${title.url}/season-1`;
const metadata = await justwatchDetails(titleUrl);
const episode = metadata.seasons.flatMap(season => season.episodes)
  .find(item => item.number === 1 && item.title === "The Dragon's Call");
if (!episode) throw new Error('Merlin S1E1 was not present in this region’s catalog response.');
const offer = metadata.offers.find(item => item.provider === 'The Roku Channel' && item.scope === 'episode' && item.episodeNumber === 1);
if (offer) {
  const watch = await justwatchWatch(titleUrl, {
    provider: offer.provider,
    seasonNumber: offer.seasonNumber ?? undefined,
    episodeNumber: offer.episodeNumber ?? undefined,
    scope: offer.scope
  });
  console.log({ episode: episode.title, provider: watch.providerOffer.provider, url: watch.watchUrl, downloadable: watch.downloadable });
}
```

As checked on 2026-11-13, the live US catalog distinguished the 2008 series from a separate 1998 *Merlin* listing, and its Season 1 page identified S1E1 as “The Dragon’s Call.” The parsed JustWatch offer cards included episode-scoped Roku, CW and Fawesome routes, a season-scoped Tubi route, and season-level Amazon trial/purchase offers. JustWatch’s page summary also mentioned Pluto TV, but this live page response had no clickable Pluto offer card for `justwatchWatch()` to return; the official Pluto S1E1 page was verified separately. Offers and clickouts vary by time and region. Amazon documents individual-episode downloads through its supported Prime Video app when a title and the user's entitlement allow it; those app-managed offline copies are not exposed as standalone `social-dl` media.

When an offer is present, `justwatchDl()` rejects it instead of interpreting a clickout or HLS playlist as a download. For generic supported HLS integrations elsewhere in the package, expired manifests return `SOURCE_EXPIRED`, authentication/authorization failures return `PRIVATE_OR_LOGIN_REQUIRED`, missing manifests return `NOT_FOUND`, temporary HTTP/network failures return `SOURCE_UNAVAILABLE`, and malformed or non-finite playlists remain `HLS_UNVERIFIABLE`. CAPTCHA, sign-in, subscription/payment, DRM, ad, and geographic controls are not bypassed. The official [JustWatch Partner API](https://apis.justwatch.com/docs/api/) requires partner access; no provider-authorized third-party download integration is configured here.

Availability changes over time. Netflix, Hulu, Disney+, and other licensed-provider offers remain catalog links and are not extracted or bypassed.

Fawesome offers follow the same catalog-versus-media boundary. When JustWatch lists Fawesome, `justwatchWatch()` can return the official episode page; `justwatchDl()` never exposes the ad-supported player HLS as a stream or downloadable file. The playlist does not establish ad preservation or third-party download authorization. Future Today's [Terms of Use](https://futuretodayinc.com/terms) restrict copying or distributing service content without prior written authorization and prohibit circumventing content-use restrictions. Use the official player; no Fawesome media URL is extracted or saved.

```js
const fawesomeEpisode = metadata.offers.find(item =>
  item.provider === 'Fawesome' && item.scope === 'episode' && item.episodeNumber === 1
);
if (fawesomeEpisode) {
  const watch = await justwatchWatch(titleUrl, {
    provider: fawesomeEpisode.provider,
    seasonNumber: fawesomeEpisode.seasonNumber ?? undefined,
    episodeNumber: fawesomeEpisode.episodeNumber ?? undefined,
    scope: 'episode'
  });
  console.log(watch.watchUrl); // official Fawesome page; not a media URL
}
```

Locked, paid, CAPTCHA-protected, or browser-verification pages are reported rather than bypassed.

### NEW: Provider capabilities and plugin registry

Inspect the capabilities known for every built-in provider or for a specific URL before downloading.

```bash
npx social-dl providers
npx social-dl capabilities "https://www.goodshort.com/episode/example-12345/001-67890"
```

Library consumers can add an isolated provider without editing the built-in resolver:

```js
import { registerProvider, universalDl } from 'social-dl';

registerProvider({
  id: 'example',
  detect: url => new URL(url).hostname === 'media.example.test',
  download: async (url, options) => ({
    platform: 'example', originalUrl: url, title: 'Example media', formats: []
  })
});
```

### NEW: Optional localhost API and dashboard

Start the API only when explicitly requested. It binds to `127.0.0.1` by default and has no API-key mechanism.

```bash
npx social-dl serve --port 8787
```

Open `http://127.0.0.1:8787/` for the local dashboard. The API also provides `GET /health`, `GET /capabilities?url=...`, and JSON `POST` endpoints `/resolve`, `/stream`, `/download`, and `/catalog`. Keep it on localhost unless you deliberately place it behind your own trusted network boundary.

### NEW: Validation and security polish

Run the same checks used during development before submitting changes:

```bash
npm test
npm run check
```

`npm run check` validates JavaScript syntax, whitespace, and package contents. The exported `redact()` helper removes bearer tokens, cookies, signatures, and secret-like fields before diagnostic data is stored or shared. See [`SECURITY.md`](./SECURITY.md) for reporting guidance.

## Why social-dl?

| Capability | social-dl | Proxy downloader API |
|---|---:|---:|
| Direct CDN extraction | Yes | No |
| Depends on a third-party API staying online | No | Yes |
| API key required | No | Often |
| Open source | No — proprietary | Varies |

## Install

```bash
npm install social-dl
```

social-dl uses the verified yt-dlp executable bundled with the package, including on Android/Termux. If yt-dlp cannot retrieve a source, social-dl tries Cobalt-compatible and PrexzyAPIs fallbacks. Node.js 18 or newer is required. When an extractor provides the source runtime, direct saves use `ffprobe` to reject incomplete media before publishing the output; install FFmpeg (which normally includes `ffprobe`) for that check. License and third-party notices for the bundled release are included under [`licenses/yt-dlp/`](./licenses/yt-dlp/).

## Pinned yt-dlp engine

yt-dlp is vendored, pinned, and verified: it ships inside the package instead of being resolved at runtime.

| Platform | Vendored binary | Integrity |
|---|---|---|
| Linux | [`bin/yt-dlp`](./bin/yt-dlp) | verified against `SHA2-256SUMS` |
| macOS | [`bin/yt-dlp_macos`](./bin/yt-dlp_macos) | verified against `SHA2-256SUMS` |
| Windows | [`bin/yt-dlp.exe`](./bin/yt-dlp.exe) | verified against `SHA2-256SUMS` |

The pinned release is recorded in `licenses/yt-dlp/VERSION`, in the official `licenses/yt-dlp/SHA2-256SUMS`, and in the `YTDLP_VERSION` / `YTDLP_SHA256` constants of [`src/core/binary.js`](./src/core/binary.js) — all three are kept in sync.

**The runtime never downloads or discovers yt-dlp.** It does not fetch from GitHub, search `PATH`, read `YTDLP_PATH`, use `yt-dlp-exec`, or install an external downloader. It resolves the executable vendored in this package and fails loudly if that file is missing.

### Keeping yt-dlp current

Updates are prepared automatically and reviewed by a human — never silently applied:

- [`.github/workflows/update-ytdlp.yml`](./.github/workflows/update-ytdlp.yml) runs on the first day of every month, and on demand through `workflow_dispatch`.
- It resolves the latest **stable** yt-dlp release, rejecting drafts, prereleases, and tags that are not in `YYYY.MM.DD` form.
- Every binary is verified against that release's official `SHA2-256SUMS` before anything is replaced, and the official `LICENSE` and `THIRD_PARTY_LICENSES.txt` are refreshed from the same tag.
- The verified result is pushed to an `automation/yt-dlp-<version>` branch and opened as a **reviewable pull request**. Nothing is committed to `main` automatically, and the pull request is never auto-merged.

Run the same update locally with:

```bash
node scripts/update-ytdlp.mjs
```

The updater uses only Node.js built-ins, writes every file atomically (temp file plus rename) so a failed run cannot leave a partial binary behind, preserves the executable bit on the Linux and macOS binaries, and is idempotent — re-running it against an already-pinned release leaves the working tree untouched.

## Termux setup

```bash
pkg update
pkg install nodejs ffmpeg python
npm install -g social-dl
npx social-dl doctor
```

If a platform blocks the network, retry with a permitted cookie export or proxy rather than repeatedly hammering the provider. Keep yt-dlp and FFmpeg current through the package release; social-dl pins its bundled yt-dlp engine for reproducible behavior.

## CLI

```bash
# Download the best available format; without -o, social-dl chooses a filename.
npx social-dl https://youtu.be/BJs3DBrMTSc
npx social-dl https://youtu.be/BJs3DBrMTSc --mp3 -o audio.mp3

# Download several links with bounded concurrency. One URL per line; blank lines
# and lines beginning with # are ignored. Completed URLs can be archived so a
# rerun resumes safely without downloading them again.
npx social-dl --file links.txt --workers 3 --archive downloads.txt --skip-existing --output-dir downloads
npx social-dl URL1 URL2 URL3 --workers 2 --output-dir downloads
npx social-dl URL --template '{platform}/{creator}/{title} [{id}].{ext}' --metadata --thumbnail
npx social-dl URL --subtitles --subtitle-lang en

# Inspect normalized metadata and formats without downloading.
npx social-dl https://facebook.com/share/r/xxx/ --json

# Common video options.
npx social-dl https://www.tiktok.com/@user/video/123 --no-watermark
npx social-dl https://youtu.be/BJs3DBrMTSc --format mp4 --quality 720p -o video.mp4
npx social-dl https://youtu.be/BJs3DBrMTSc --safe-mode -o video.mp4

# Login-required sources can use an exported Netscape cookie file or a browser cookie store.
npx social-dl https://www.instagram.com/reel/CODE/ --cookies ~/cookies.txt -o instagram.mp4
npx social-dl https://www.tiktok.com/@user/video/123 --cookies-from-browser chrome -o tiktok.mp4

# Spotify is audio-only and performs a confidence-checked source match.
npx social-dl https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs -o dreams.mp3
npx social-dl https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs --json

# RedNote/Xiaohongshu links may need the xsec_token included in the copied public URL.
npx social-dl "https://www.xiaohongshu.com/explore/POST_ID?xsec_token=TOKEN&xsec_source=" --json
npx social-dl "https://www.xiaohongshu.com/explore/POST_ID?xsec_token=TOKEN&xsec_source=" -o rednote.mp4

# Threads public pages may expose either video formats or an image carousel.
npx social-dl https://www.threads.net/@user/post/POST_ID --json
npx social-dl https://www.threads.net/@user/post/POST_ID -o threads.mp4

# Apple Music keeps Apple catalog metadata; it saves a strict external match or, if none is confident, the official preview.
npx social-dl "https://music.apple.com/us/album/shape-of-you/1193701079?i=1193701392" --json
npx social-dl "https://music.apple.com/us/album/shape-of-you/1193701079?i=1193701392" -o apple-match.mp3

# Bilibili public BV videos use the public metadata endpoint and the bundled yt-dlp extractor.
npx social-dl "https://www.bilibili.com/video/BV1xx411c7m9" --json
npx social-dl "https://www.bilibili.com/video/BV1xx411c7m9" --quality 720p -o bilibili.mp4
# Audiomack saves a signed public M4A.
npx social-dl https://audiomack.com/ifykeyz_page/song/min-obele-gozie-live-performance --json
npx social-dl https://audiomack.com/artist/song/short-public-track -o audiomack.m4a

# DramaFren follows the public OK.ru player and resolves the signed HLS stream.
npx social-dl https://dramafren.org/watch/my-teenage-mother/ --json
npx social-dl https://dramafren.org/watch/my-teenage-mother/ --best --lan en -o my-teenage-mother.mp4
npx social-dl https://dramafren.org/watch/my-teenage-mother/ --quality 480p -o my-teenage-mother-480p.mp4

# Official short-drama providers use the same CLI shape. DramaBox's native
# episode URL has the form /ep/BOOK_ID_title-slug/CHAPTER_ID_Episode-N.
npx social-dl "https://www.dramaboxdb.com/ep/42000021648_my-teenage-mother-dubbed/701326021_Episode-24" --json --lan en
npx social-dl "https://www.dramaboxdb.com/ep/42000021648_my-teenage-mother-dubbed/701326021_Episode-24" --best --lan en -o dramabox.mp4
# These public native episode URLs are checked and then resolved to the matching
# provider and episode through the public cross-provider link resolver.
npx social-dl "https://www.reelshort.com/episodes/episode-1-the-triplets-final-regret-6aafa7fc530d47585a054f74-aqthox3d16?play_time=1" --best -o reelshort.mp4
npx social-dl "https://www.goodshort.com/episode/mommy-i-brought-dragon-king-daddy-home-31001848225/001-69346624" --best -o goodshort.mp4
npx social-dl "https://www.shorttv.live/episode/village-drama-no-filters-19998-11" --best -o shortmax.mp4
npx social-dl "https://www.flickreels.net/playlist/they-dont-know-im-the-dons-pregnant-queen/9321/episode-1" --best -o flickreels.mp4
# Language and resolution flags are shared with the other CLI routes; a source
# may offer only one language or resolution, in which case its available format is used.
npx social-dl "https://www.goodshort.com/episode/mommy-i-brought-dragon-king-daddy-home-31001848225/001-69346624" --quality 480p --lang id -o goodshort-id.mp4
# AnyDrama watch routes are provider-agnostic; a series URL without an episode suffix defaults to Episode 1.
npx social-dl "https://any-drama.com/en/watch/reelshort-found-a-homeless-billionaire-husband-for-christmas-6752885d3d9eb9334300b6ca/1" --json
npx social-dl "https://any-drama.com/en/watch/freereels-his-on-call-heiressdubbed-u2veOToC04/1" --best -o freereels.mp4
npx social-dl "https://any-drama.com/en/watch/shortmax-mommy-im-not-lyingupdating-18550" --best -o shortmax.mp4
# Episode-specific AnyDrama routes use the requested number and its page-bound playback ID.
npx social-dl "https://any-drama.com/en/watch/dramabox-divorced-at-the-wedding-day-41000116643/33" --best -o anydrama-episode-33.mp4
# DramaBox share links resolve through AnyDrama first; the existing public fallback remains available.
# Replace the placeholder values with a copied public share URL (quote the full URL).
npx social-dl "https://sharet.dramabox.com/play?bid=BOOK_ID&cid=CHAPTER_ID&cindex=N&lan=en" --best --lan en -o dramabox-share.mp4

AnyDrama watch-page URLs use one provider-agnostic adapter across its current catalog. Native ReelShort, GoodShort, ShortMax and FlickReels episode URLs are recognized by exact host/path patterns, checked on their public pages, and resolved only when AnyDrama returns the same provider and episode. CAPTCHA/browser verification, locked or paid episodes, mismatched episodes, and unrecognized routes stop with a clear error; social-dl does not bypass provider access controls. HLS saves are compared with the finite playlist’s advertised duration when the source exposes it. There is no fixed minimum runtime: short media is kept when it matches the source runtime, while a truncated FFmpeg output is rejected and eligible GoodShort/ReelShort downloads retry their native public adapter.

npx social-dl "https://www.goodshort.com/episode/i-steal-better-than-you-31001365025/067-17989995" --quality best --lan en -o goodshort.mp4
npx social-dl "https://www.flextv.cc/episodes/episode-1-a-pinch-of-little-witch-A3zjDM5ZXY" --best --lan en -o flextv.mp4
npx social-dl "https://www.moboreels.com/episode/daddy-will-you-love-me-112418322-01" --quality 720p --lan en -o moboreels.mp4
npx social-dl "https://www.reelshort.com/en/embed/6aafa7fc530d47585a054f74-aqthox3d16" --best --lan en -o reelshort.mp4

# Browse normalized short-drama catalog metadata. Results include title, cover,
# episode number, lock state, official URL, and source order.
npx social-dl catalog dramabox --category trending --lan en
npx social-dl catalog flextv --category ranking --lan en
npx social-dl catalog goodshort --category hot --lan en
npx social-dl catalog reelshort --category latest --lan en
npx social-dl catalog moboreels --query "daddy will you love me" --lan en

# Resolve a fresh direct HLS/MP4 URL without downloading. Useful for mpv, VLC,
# browser players, or another application. Add --json for metadata plus URL.
npx social-dl "https://www.flextv.cc/episodes/episode-1-SLUG-SERIES" --stream --best --lan en

# DramaBox share links first check the public share page, then the matching
# official episode route if needed. Replace the placeholder IDs with a copied URL.
npx social-dl "https://sharet.dramabox.com/play?bid=BOOK_ID&cid=CHAPTER_ID&cindex=N&lan=en" --stream --best --lan en

## Stream troubleshooting

`--stream` resolves metadata first and prints only a verified public media URL. It never saves the media file. The selected format may be HLS (`.m3u8`) or a direct MP4, depending on what the provider exposes at that moment.

`UNSUPPORTED_URL` means social-dl does not recognize the URL form. For DramaBox share links, social-dl first inspects the public share page and, when it has no usable source, derives a conservative title slug and checks the matching official `dramaboxdb.com/ep/...` route. It checks the official movie route only when the episode route is unavailable or cannot safely be constructed and the public page provides a usable title and book ID. It reports a not-found error if no verified public video source is available. Cover images (including names ending in `.mp4.jpg`), DRM, login/payment gates, and CAPTCHA pages are never treated as media or bypassed. The original share URL is retained as `originalUrl`, and the official page URL is exposed as `resolvedUrl` in JSON output.

### Short-drama Worker fallback

Direct provider requests are always attempted first. When DramaBox, DramaFren, GoodShort, FlexTV, MoboReels, or ReelShort returns a provider-blocking response such as HTTP 403, a bot challenge, or CAPTCHA, `universalSave()` can retry through the configured short-drama Worker. The default endpoint is `https://db.codyai.workers.dev/v1/short-drama`; override it with `SOCIAL_DL_SHORT_DRAMA_WORKER_URL` and set its bearer secret with `SOCIAL_DL_SHORT_DRAMA_WORKER_TOKEN` (or `DRAMABOX_WORKER_TOKEN`). Secrets are read from the environment and are never embedded in the package.

# Diagnostics, maintenance, and version/help output.
npx social-dl doctor --json
npx social-dl maintenance
npx social-dl --version
npx social-dl --help
```

### Easy format and quality selection

Every supported platform uses the same command shape. `mp4` is the default video mode; `mp3` uses FFmpeg to extract audio when the source provides a compatible audio stream. Apple Music external matches are saved as `.mp3`; a no-match preview fallback is native `.m4a` unless the requested output is `.mp3`, in which case FFmpeg converts it. Audiomack tracks are native M4A files and keep the `.m4a` extension.

```bash
# Interactive Termux-friendly menu
npx social-dl

# Direct commands
npx social-dl "URL" --format mp4 --quality best -o video.mp4
npx social-dl "URL" --format mp4 --quality 720p -o video.mp4
npx social-dl "URL" --format mp3 -o audio.mp3
npx social-dl "URL" --format mp4 --quality 720p --safe -o video.mp4

# Equivalent shorthand for MP3
npx social-dl "URL" --mp3 -o audio.mp3
```

The interactive menu auto-detects the pasted URL and supports the same public provider routes as the direct CLI. For short dramas it asks for format, quality and an optional language code. An unsupported or malformed URL reports the problem and returns to the menu instead of terminating the session; use the URL patterns in the platform list below.

`--quality best|720p|480p` applies to video downloads when the provider exposes selectable formats. Without `-o`, the CLI chooses a filename from the post ID, preserves native extensions such as `.m4a`, and uses `.mp3` for converted `--mp3` downloads. Facebook and Instagram photo posts/carousels, RedNote and Threads image posts, and TikTok photo posts are saved as numbered images in an `<post-id>-photos` folder. `--safe`/`--safe-mode` adds conservative yt-dlp pacing (`3–6` second sleeps and a `5M` rate limit); it reduces request pressure but is not an anti-bot bypass. Use cookies or a permitted proxy for content requiring authentication. SaveTube is an explicit library adapter (`social-dl/savetube`), not a separate URL-detectable CLI mode; the normal CLI YouTube command uses the direct YouTube extractor instead.

Batch mode keeps the normal resolver and saver for every URL. `--workers` is capped at eight, `--archive` records only completed or existing items, and failed items remain available in the JSON summary for retry. Use `--stop-on-error` when a batch should stop assigning new work after the first failure.

Use `--template` to organize output with `{platform}`, `{creator}`, `{author}`, `{title}`, `{id}`, `{episode}`, and `{ext}` placeholders. `--metadata` writes an adjacent `.info.json` sidecar; adding `--thumbnail` also saves the provider thumbnail when one is available.

The optional API binds to `127.0.0.1` by default. Open its root URL for a small local dashboard, or use `GET /health`, `GET /capabilities?url=...`, and JSON `POST` endpoints `/resolve`, `/stream`, `/download`, and `/catalog`. It is never started by normal download commands and has no API-key mechanism.

Library consumers can register an isolated provider with `registerProvider({ id, detect, download, save })`. Registered providers are checked before built-in detection; invalid provider IDs or missing required functions are rejected, and built-in providers remain untouched.

Catalog adapters now include DramaBox, GoodShort, FlexTV, MoboReels, ReelShort, DramaFren, AnyDrama, ShortMax, and FlickReels. These adapters discover public catalog pages and mark locked items rather than attempting to bypass them.

### Persistent queue

For a queue that survives separate CLI runs, add URLs to the local queue file, inspect it, and run it later:

```bash
npx social-dl queue add URL1 URL2 --queue-file downloads.queue.json
npx social-dl queue list --queue-file downloads.queue.json
npx social-dl queue run --workers 3 --output-dir downloads --queue-file downloads.queue.json
npx social-dl queue retry-failed --workers 2 --queue-file downloads.queue.json
npx social-dl series "https://www.goodshort.com/drama/example-12345"
npx social-dl providers
npx social-dl capabilities "https://www.goodshort.com/episode/example-12345/001-67890"
npx social-dl serve --port 8787
```

Queue execution uses the same provider resolver and saver as direct downloads. Completed, skipped, and failed states are retained in an atomically replaced JSON file; failed items can be retried without re-adding their URLs.

### Spotify track links

`social-dl` reads Spotify track metadata directly from Spotify's public embed page and does not depend on `spotify.xwolf.space`, a Spotify bearer token, or a developer account. For a full-length MP3, it searches the bundled yt-dlp-supported source using the Spotify title, artist, and duration, and saves only a sufficiently close candidate. Audio retrieval tries the primary yt-dlp path, the package's generic fallbacks, then the existing `youtubeMp3Save()` path; if that returns native M4A/Opus audio, FFmpeg converts it to MP3. The result keeps `platform: "spotify"` for the input link and includes `matchedSource`/`audioSource` so developers can see where the audio actually came from. If the match is uncertain, it raises `NoConfidentMatchError` (`NO_CONFIDENT_MATCH`) and downloads nothing. This is not a full-track Spotify stream; it can fail if the external result is unavailable or requires permitted cookies. A `previewUrl`, when Spotify supplies one, is only preview metadata and is not used as a substitute for the full track.

```js
import { spotifyMetadata, spotifyDl, spotifySave } from 'social-dl/spotify';

const metadata = await spotifyMetadata('https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs');
const resolved = await spotifyDl(metadata.originalUrl); // metadata + validated match
await spotifySave(metadata.originalUrl, './dreams.mp3');
```

Run `npx social-dl doctor` to verify Node.js, FFmpeg, the pinned yt-dlp binary/version, and provider reachability before troubleshooting a download. Use `npx social-dl maintenance` for the interactive engine update and safe cache reset menu; reset never deletes downloaded media. `--format mp3` requires FFmpeg; if a platform only exposes a ready-made media file, social-dl keeps the provider’s native media instead of pretending it can convert it. `--json` shows normalized metadata and available formats before saving, while `--no-watermark` requests a no-watermark variant when the provider supports one.

For login-required Instagram or TikTok posts, pass an exported cookie file with `--cookies path/to/cookies.txt` or use `--cookies-from-browser chrome`, `firefox`, `edge`, or `brave`. YouTube may reject datacenter IPs; `doctor` reports this as `BOT_DETECTED`.

## Library

```js
import { universalDl, universalSave, universalStream } from 'social-dl';

const data = await universalDl('https://youtu.be/BJs3DBrMTSc');
await universalSave('https://youtu.be/BJs3DBrMTSc', './video.mp4');
```

### Platform-specific library examples

Every platform also exposes its own `xxxDl()` and `xxxSave()` functions. Each `Dl()` call returns normalized metadata and direct CDN formats; each `Save()` call downloads the selected format.

#### Facebook

```js
import { facebookDl, facebookSave } from 'social-dl/facebook';

const facebook = await facebookDl('https://www.facebook.com/reel/1234567890/');
await facebookSave('https://www.facebook.com/reel/1234567890/', './facebook.mp4', 'HD');
```

Public Facebook photo posts and carousels return `mediaType: "photo"` and an `images` array. `facebookSave()` writes the gallery as numbered image files in `./facebook-photos/` when the destination is `./facebook.mp4`. A photo post passed to the video-only `download()` path raises `FACEBOOK_PHOTO_POST`; use `facebookSave()` for the gallery. Image extraction uses public page metadata and does not bypass login, privacy, CAPTCHA, or access controls.

#### YouTube video

```js
import { youtubeDl, youtubeSave } from 'social-dl/youtube';

const youtube = await youtubeDl('https://youtu.be/BJs3DBrMTSc');
await youtubeSave('https://youtu.be/BJs3DBrMTSc', './youtube.mp4', '720p');
```

#### YouTube audio

```js
import { youtubeMp3Dl, youtubeMp3Save } from 'social-dl/ytmp3';

const audio = await youtubeMp3Dl('https://youtu.be/BJs3DBrMTSc');
await youtubeMp3Save('https://youtu.be/BJs3DBrMTSc', './audio.m4a');
```

#### Instagram

```js
import { instagramDl, instagramSave } from 'social-dl/instagram';

const instagram = await instagramDl('https://www.instagram.com/reel/CODE/', { cookiesPath: './cookies.txt' });
await instagramSave('https://www.instagram.com/reel/CODE/', './instagram.mp4', 'best', { cookiesPath: './cookies.txt' });
```

Public Instagram image posts and carousels return `mediaType: "photo"` and an `images` array. `instagramSave()` writes the gallery as numbered image files in `./instagram-photos/` when the destination is `./instagram.mp4`. A photo post passed to the video-only `download()` path raises `INSTAGRAM_PHOTO_POST`; use `instagramSave()` for the gallery. For login-required posts, provide permitted cookies with `--cookies` or the corresponding library options. The adapter does not bypass login, privacy, CAPTCHA, or other provider access controls.

#### TikTok

```js
import { tiktokDl, tiktokSave } from 'social-dl/tiktok';

const tiktok = await tiktokDl('https://www.tiktok.com/@user/video/1234567890123456789', { cookiesFromBrowser: 'chrome' });
await tiktokSave('https://www.tiktok.com/@user/video/1234567890123456789', './tiktok.mp4', 'NOWM', { cookiesFromBrowser: 'chrome' });
```

TikTok photo posts are detected separately from videos. `tiktokDl()` returns `mediaType: "photo"` and an `images` array; `tiktokSave()` and the CLI save the carousel as numbered image files in a folder (the CLI's default folder name is `<post-id>-photos`).

#### Twitter/X

```js
import { twitterDl, twitterSave } from 'social-dl/twitter';

const tweet = await twitterDl('https://x.com/user/status/1851234567890');
await twitterSave('https://x.com/user/status/1851234567890', './twitter.mp4');
```

#### Pinterest

```js
import { pinterestDl, pinterestSave } from 'social-dl/pinterest';

const pin = await pinterestDl('https://www.pinterest.com/pin/1234567890/');
await pinterestSave('https://www.pinterest.com/pin/1234567890/', './pinterest.mp4');
```

#### CapCut

```js
import { capcutDl, capcutSave } from 'social-dl/capcut';

const template = await capcutDl('https://www.capcut.com/template-detail/1234567890');
await capcutSave('https://www.capcut.com/template-detail/1234567890', './capcut.mp4');
```

#### RedNote / Xiaohongshu

```js
import { rednoteDl, rednoteSave } from 'social-dl/rednote';

const post = await rednoteDl('https://www.xiaohongshu.com/explore/POST_ID');
await rednoteSave('https://www.xiaohongshu.com/explore/POST_ID', './rednote.mp4', 'best');
// Photo carousels return mediaType: "photo" and an images array.
```

#### Apple Music metadata and matched audio

```js
import { applemusicDl, applemusicSave } from 'social-dl/applemusic';

const track = await applemusicDl('https://music.apple.com/us/album/shape-of-you/1193701079?i=1193701392');
// track.platform remains "applemusic"; matchedSource identifies the external audio source.
await applemusicSave(track.originalUrl, './apple-match.mp3');
// Saves a confident external match; otherwise saves Apple's official preview.
```

`applemusicMetadata(url)` returns Apple catalog metadata and its official preview without searching. `applemusicDl(url)` applies the same conservative external-source match used for Spotify. A successful match does not come from Apple Music; the result keeps `platform: "applemusic"` and discloses the source in `audioSource`, `matchedSource`, and `isExternalMatch`. Matching checks title, artist, version markers, and full-track duration. If no candidate passes the existing strict confidence threshold, the result instead returns Apple's official preview with `isPreviewFallback: true`, `matchStatus: "no_confident_match"`, and the best candidate confidence if available. Saving then uses the roughly 30-second M4A preview (or converts it to MP3 when the requested path ends in `.mp3`). Provider and network failures are not treated as no-match results and still surface as errors.

#### Threads

```js
import { threadsDl, threadsSave } from 'social-dl/threads';

const post = await threadsDl('https://www.threads.net/@user/post/POST_ID');
await threadsSave(post.originalUrl, './threads.mp4');
// Public image posts return mediaType: "photo" and an images array.
```

#### Audiomack

```js
import { audiomackDl, audiomackSave } from 'social-dl/audiomack';

const track = await audiomackDl('https://audiomack.com/ifykeyz_page/song/min-obele-gozie-live-performance');
await audiomackSave(track.originalUrl, './audiomack.m4a');
// Audiomack signed URLs are resolved fresh and expire; save immediately.
```

#### SaveTube adapter

```js
import { savetubeDl, savetubeSave } from 'social-dl/savetube';

const video = await savetubeDl('https://youtu.be/BJs3DBrMTSc');
await savetubeSave(video.originalUrl, './savetube.mp4', 'best');
```

Direct SaveTube saving requires `SOCIAL_DL_SAVETUBE_SECRET` (the legacy `secretKey` variable is also accepted). If it is not configured, use the normal YouTube extractor or report the explicit configuration error; do not treat a Nexray response as the SaveTube implementation.

### Short-drama library examples

Each provider module exports its own `xxxDl()` metadata resolver and `xxxSave()` downloader. These providers only return public HLS/MP4 sources when they are exposed by the page; the examples do not bypass login, payment, CAPTCHA, or DRM protections.

```js
import { dramaboxDl, dramaboxSave } from 'social-dl/dramabox';
import { anydramaDl, anydramaSave } from 'social-dl/anydrama';
import { dramafrenDl, dramafrenSave } from 'social-dl/dramafren';
import { goodshortDl, goodshortSave } from 'social-dl/goodshort';
import { flextvDl, flextvSave } from 'social-dl/flextv';
import { moboreelsDl, moboreelsSave } from 'social-dl/moboreels';
import { reelshortDl, reelshortSave } from 'social-dl/reelshort';
import { shortmaxDl, shortmaxSave } from 'social-dl/shortmax';
import { flickreelsDl, flickreelsSave } from 'social-dl/flickreels';

const dramaboxUrl = 'https://www.dramaboxdb.com/ep/42000021648_my-teenage-mother-dubbed/701326021_Episode-24';
const dramabox = await dramaboxDl(dramaboxUrl, { lan: 'en' });
await dramaboxSave(dramaboxUrl, './dramabox.mp4', 'best', { lan: 'en' });

const anydramaUrl = 'https://any-drama.com/en/watch/dramabox-divorced-at-the-wedding-day-41000116643/33';
const anydrama = await anydramaDl(anydramaUrl);
await anydramaSave(anydramaUrl, './anydrama-episode-33.mp4');

// Set DRAMABOX_SHARE_URL to a copied public sharet.dramabox.com/play link.
// The share resolver preserves originalUrl and reports its official page as resolvedUrl.
const shareUrl = process.env.DRAMABOX_SHARE_URL;
const sharedDrama = await dramafrenDl(shareUrl, { lan: 'en' });
console.log(sharedDrama.originalUrl, sharedDrama.resolvedUrl);
await dramafrenSave(shareUrl, './dramabox-share.mp4', 'best', { lan: 'en' });

const goodshortUrl = 'https://www.goodshort.com/episode/i-steal-better-than-you-31001365025/067-17989995';
const goodshort = await goodshortDl(goodshortUrl, { lan: 'en' });
await goodshortSave(goodshortUrl, './goodshort.mp4', 'best', { lan: 'en' });

const flextvUrl = 'https://www.flextv.cc/episodes/episode-1-a-pinch-of-little-witch-A3zjDM5ZXY';
const flextv = await flextvDl(flextvUrl, { lan: 'en' });
await flextvSave(flextvUrl, './flextv.mp4', 'best', { lan: 'en' });

const moboreelsUrl = 'https://www.moboreels.com/episode/daddy-will-you-love-me-112418322-01';
const moboreels = await moboreelsDl(moboreelsUrl, { lan: 'en' });
await moboreelsSave(moboreelsUrl, './moboreels.mp4', 'best', { lan: 'en' });

const reelshortUrl = 'https://www.reelshort.com/en/embed/6aafa7fc530d47585a054f74-aqthox3d16';
const reelshort = await reelshortDl(reelshortUrl, { lan: 'en' });
await reelshortSave(reelshortUrl, './reelshort.mp4', 'best', { lan: 'en' });

// These named adapters accept verified native episode URLs and resolve them
// through AnyDrama while preserving the original provider in returned metadata.
const shortmaxUrl = 'https://www.shorttv.live/episode/village-drama-no-filters-19998-11';
const shortmax = await shortmaxDl(shortmaxUrl, { lang: 'en' });
await shortmaxSave(shortmaxUrl, './shortmax.mp4', '720p', { lang: 'en' });

const flickreelsUrl = 'https://www.flickreels.net/playlist/they-dont-know-im-the-dons-pregnant-queen/9321/episode-1';
const flickreels = await flickreelsDl(flickreelsUrl, { lan: 'en' });
await flickreelsSave(flickreelsUrl, './flickreels.mp4', 'best', { lan: 'en' });
```

### Express/Next.js streaming

```js
const { stream, contentType, filename } = await universalStream(url);
res.setHeader('Content-Type', contentType);
res.setHeader('Content-Disposition', `inline; filename="${filename}"`);
Readable.fromWeb(stream).pipe(res);
```
### [NEW] Spotify 
```js
import { spotifyDl, spotifySave } from 'social-dl/spotify';

const template = await spotifyDl('https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs');
await spotifySave('https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs', './spotify.mp3');
```

## Platforms

| Platform | Example |
|---|---|
| Facebook | `https://www.facebook.com/reel/1234567890/` |
| YouTube | `https://youtu.be/BJs3DBrMTSc` |
| Instagram | `https://www.instagram.com/reel/CODE/` |
| TikTok | `https://www.tiktok.com/@user/video/123` |
| Twitter/X | `https://x.com/user/status/123` |
| Pinterest | `https://www.pinterest.com/pin/1234567890/` |
| CapCut | `https://www.capcut.com/template-detail/1234567890` |
| RedNote / Xiaohongshu | `https://www.xiaohongshu.com/explore/POST_ID` |
| Threads | `https://www.threads.net/@user/post/POST_ID` |
| Apple Music matched track | `https://music.apple.com/us/album/shape-of-you/1193701079?i=1193701392` |
| Audiomack | `https://audiomack.com/ifykeyz_page/song/min-obele-gozie-live-performance` |
| DramaBox | `https://www.dramaboxdb.com/ep/BOOK_ID_title-slug/CHAPTER_ID_Episode-1` or a public `sharet.dramabox.com/play?...` link |
| AnyDrama | `https://any-drama.com/en/watch/SLUG-SERIES_ID/EPISODE` or a DramaBox sharet link resolved through AnyDrama |
| GoodShort | `https://www.goodshort.com/episode/SLUG-BOOK/001-EPISODE` |
| FlexTV | `https://www.flextv.cc/episodes/episode-1-SLUG-SERIES` |
| MoboReels | `https://www.moboreels.com/episode/SLUG-SERIES-01` |
| ReelShort | `https://www.reelshort.com/en/embed/TITLE-EPISODE` |
| ShortMax | `https://www.shorttv.live/episode/TITLE-SERIES-EPISODE` |
| FlickReels | `https://www.flickreels.net/playlist/TITLE/SERIES_ID/episode-1` |
| DramaFren | `https://dramafren.org/watch/SLUG/` |
| SaveTube adapter | YouTube URLs through `social-dl/savetube` |
| YouTube audio | Same YouTube URLs with `{ audioOnly: true }` or `--mp3` |
| Spotify track | `https://open.spotify.com/track/0wf9rSX8ds3yEI2gf2QdPs` (MP3; match-checked) |

## API reference

- `universalDl(url, { audioOnly, quality, cookiesPath, cookiesFromBrowser })` — return normalized direct-CDN formats.
- `universalSave(url, destination, { audioOnly, quality, noWatermark, cookiesPath, cookiesFromBrowser, safeMode })` — save a selected format. `safeMode: true` enables conservative pacing for yt-dlp. `audioOnly: true` is the library equivalent of `--format mp3`.
- The shared CLI works across YouTube, TikTok, Facebook, Instagram, Twitter/X, Pinterest, CapCut, RedNote, Threads, Apple Music, Audiomack, DramaBox, AnyDrama, DramaFren, GoodShort, FlexTV, MoboReels, ReelShort, ShortMax and FlickReels. Public ReelShort, GoodShort, ShortMax and FlickReels links can resolve through AnyDrama when the page and episode match. Video quality and audio conversion depend on the formats and FFmpeg support available for each source; `lan`/`lang` is forwarded to short-drama page, playback and media requests. HLS outputs are checked against finite playlist duration, not a fixed minimum. Apple Music keeps its catalog metadata but saves only a confidence-checked external audio match as MP3; it does not download the matched audio from Apple Music. Audiomack resolves a signed public M4A playback URL. DramaBox share links first use AnyDrama’s public link resolver and page-bound playback API; the existing DramaFren/official-page path remains the fallback when mapping is unavailable or a duration check detects truncation. VIP labels alone are not treated as proof of a lock, and denied playback is not bypassed.
- `universalStream(url, options)` — return a Web `ReadableStream` for piping.
- `spotifyMetadata(url)` — read public Spotify embed metadata for a track, album, artist, or playlist without using the WOLF API.
- `spotifyDl(url, options)` — return track metadata plus a conservative separate-source audio match; `formats` is empty because the match is not a Spotify CDN URL.
- `spotifySave(url, destination, quality, options)` — download the validated track match as MP3; may require FFmpeg and/or permitted source cookies.
- `doctor({ log })` — test provider reachability, Node, FFmpeg, and the bundled yt-dlp engine.
- `npx social-dl maintenance` — interactively update the yt-dlp engine or reset only generated cache/cookie state; downloaded media is preserved.
- Every platform exports `xxxDl()` and `xxxSave()`.

## Fallback Credits

social-dl uses multiple fallback services to improve download reliability:

- PrexzyAPIs.com
- Cobalt-compatible endpoints

Fallbacks are used when the primary yt-dlp path cannot retrieve media. Third-party services may be unavailable or change behavior.

Set `SOCIAL_DL_PROXY` to use a proxy for the primary yt-dlp request. The fallback services do not require this variable. For YouTube bot checks, provide an exported Netscape cookie file with `--cookies path/to/youtube-cookies.txt`, use `--cookies-from-browser chrome`, or set `SOCIAL_DL_YOUTUBE_COOKIES` / `SOCIAL_DL_YOUTUBE_COOKIES_FROM_BROWSER`. social-dl tries multiple yt-dlp YouTube clients before using Cobalt and Prexzy; third-party services can still be unavailable or block the source.

## Support the creator

If social-dl helps your projects, support development through any of these options:

### Bank transfer (Nigeria)

- **Bank:** First Bank Nigeria
- **Account name:** CRYSTAL-LEVI UZOUKWU
- **Account number:** `3230171045`

### Telegram Stars

Use the bot donation shortcut: [@CODYEBOT — Donate](https://t.me/CODYEBOT?start=donate). You can also reach [@crysnovax](https://t.me/crysnovax) or [@plogme](https://t.me/plogme).

### USDT

- **Network:** BNB Smart Chain (BEP-20)
- **Address:** `0xa1140712e9a1d459fc32c7d2f7e33e18790db835`

Confirm that your wallet is set to **BEP-20 / BNB Smart Chain** before sending. Run `npx social-dl support` to print these details in the terminal.

### Scan to support

![USDT BEP-20 donation QR code](https://cdn.crysnova.qzz.io/files/1790796246940-eede6a21-3ee8-45d3-94ad-2fcd0fa82525.jpeg)

If the QR image does not render, open the direct image link: <https://cdn.crysnova.qzz.io/files/1790796246940-eede6a21-3ee8-45d3-94ad-2fcd0fa82525.jpeg>.

## Contact and community

For support, updates, and community help:

- [WhatsApp channel 1](https://whatsapp.com/channel/0029Vb8296789inZCpWLuS3T)
- [WhatsApp channel 2](https://whatsapp.com/channel/0029Vb6pe77K0IBn48HLKb38)
- [Telegram channel — CRYSNOVA AI](https://t.me/CRYSNOVA_AI)
- [CRYSNOVA platform](https://crysnovax.com)
- [Cody AI WhatsApp bot repository](https://github.com/crysnovax/CODY)

## Our other projects making use of `social-dl`
- [x] Cody AI — WhatsApp bot 
- [x] @dllogbot — telegram bot
- [x] @CODYEBOT — telegram bot
- [x] Drama Host — site for stream and download 
- [ ] CRYSNOVA AI — WhatsApp bot 

**Links**
- [Cody AI](https://github.com/crysnovax/CODY)
- [@dllogbot](https://t.me/dllogbot)
- [@CODYEBOT](https://t.me/CODYEBOT)
- [Drama Host](https://crysnovax.com)
- [CRYSNOVA AI](https://githu.com/crysnovax/CRYSNOVA_AI)
  
Run `npx social-dl support` to print donation and contact links in the terminal.

## Thenkiri provider

Thenkiri supports public movie and series pages, nested seasons/episodes, public DownloadWella form links, and direct media sources. It exposes four core modes plus an opt-in bulk catalog/link resolver through the package root and the `social-dl/thenkiri` subpath. Node.js 18 or newer is required; no additional npm dependency is needed.

```js
import {
  thenkiriSearch,
  thenkiriDetails,
  thenkiriEpisode,
  thenkiriDownload,
  thenkiriStream,
  thenkiriGetLink,
  thenkiriSearchAndResolve
} from 'social-dl/thenkiri';

// Catalog mode: search is paginated when the public results page exposes a next page.
const found = await thenkiriSearch('The Originals', { page: 1 });
console.log(found.results); // { title, description, poster, url, canonicalUrl, mediaType }

// Details include poster/description, sources, and seasons[].episodes[].
const series = await thenkiriDetails(found.results[0].url);
const episode = await thenkiriEpisode(series.originalUrl, {
  seasonNumber: 1,
  episodeNumber: 1
});

// Download mode: uses the existing streamed-to-disk saver and returns the path.
const savedPath = await thenkiriDownload(episode.sourceUrl, './The.Originals.S01E01.mkv');

// Stream mode: returns a validated Web ReadableStream, without saving a file.
const media = await thenkiriStream(episode.sourceUrl);
// Example for a Node HTTP response: Readable.fromWeb(media.stream).pipe(res)

// Download Link mode: resolves and validates the direct URL but does not fetch its body.
const link = await thenkiriGetLink(episode.sourceUrl);
console.log({ url: link.url, format: link.format, expiresAt: link.expiresAt });

// Optional bulk operation: paginate search, inspect every result, and resolve
// each unlocked public source without downloading the media bodies.
const crawl = await thenkiriSearchAndResolve('The Originals', { maxPages: 25 });
const finalLinks = crawl.results.flatMap(item =>
  item.resolvedSources.filter(source => source.status === 'resolved').map(source => source.link)
);
```

### Thenkiri bulk search from the CLI

Give the title as a quoted positional query or with `--query` / `--search`:

```bash
# Use the default page limit, starting page, and request pacing.
npx social-dl thenkiri search-resolve "The Originals"

# Use a named query and customize the starting page, crawl limit, and pacing.
npx social-dl thenkiri search-resolve --query "The Originals" --page 2 --max-pages 10 --delay-ms 500
```

The command follows public search pagination, fetches metadata for each unique result, and attempts to resolve each listed source that is not marked locked or unavailable. A successful search prints JSON, including catalog metadata, per-source resolution statuses, and resolved URLs; it does not download media bodies. `--json` is not needed for this command.

| Flag | Description |
| --- | --- |
| `--query TEXT` or `--search TEXT` | Search title; either may replace the positional query. If both are supplied, the flag value takes precedence. |
| `--page N` | Starting public search page (default: `1`). Use a whole-number page; values below `1` are treated as page `1`. |
| `--max-pages N` | Maximum number of public result pages to crawl (default: `25`; integer range: `1`–`100`). If the crawl reaches this cap while another page is available, inspect `searchComplete` and `nextPage` in the JSON; continue with `--page <nextPage>`. |
| `--delay-ms N` | Pause between sequential requests, in milliseconds (default: `350`; range: `0`–`30000`). Set to `0` to disable the extra pause. |
| `--search-url URL` | Override the public search endpoint (default: `https://thenkiri.com/`). Most users should leave this unset; use it only for an alternate public Thenkiri-compatible endpoint. |

Check `complete`, `searchComplete`, `nextPage`, `searchError`, `stoppedReason`, and each source's `status` to tell whether the crawl and link resolution finished. Locked/unavailable sources are reported rather than resolved. Verification, login/authorization, payment, CAPTCHA, rate-limit, and server gates are not bypassed; further resolution stops on those gates. Returned links may expire, and JSON headers may contain cookies, so treat the output as sensitive.

### Public methods and return values

- `thenkiriSearch(query, { page, searchUrl, signal, headers })` searches public movie/series listings. It returns `{ platform, query, count, results, page, nextPage }`; `results` contain title, description, poster, canonical URL, and `mediaType`. Follow `nextPage` when non-null. Pagination reflects what the site exposes; it is not a promise of exhaustive results.
- `thenkiriSearchAndResolve(query, { page, searchUrl, maxPages, delayMs, signal, headers, timeoutMs, resolveSource })` is an opt-in bulk operation. It follows public search pagination, retrieves metadata for each result, and resolves every listed source that is not marked locked or unavailable—including all listed episodes and movie sources—without downloading media bodies. Requests are sequential with a default 350 ms pause; `maxPages` defaults to 25 and must be an integer from 1 through 100 to bound the crawl. It returns `{ platform, query, pages, pageCount, resultCount, results, complete, searchComplete, nextPage, searchError?, stoppedReason? }`; each result has its search record, `details`, and `resolvedSources`. Each resolved-source entry has its original `source`, a `status` (`resolved`, `locked`, `unavailable`, `failed`, or `skipped`), and, when resolved, a `link` shaped like `thenkiriGetLink()`; inspect per-source status rather than assuming every link resolved. `complete` is false when the crawl is truncated, halted, or any item/source failed; `nextPage` is available when search pagination remains. Verification, authorization, rate-limit, and server errors stop further resolution and appear as `stoppedReason`; the method does not retry ambiguous form submissions or bypass access controls. Link URLs may expire, and returned link headers can contain cookies—treat them as sensitive and do not persist them in logs.
- `thenkiriDetails(url, options)` (also available as the backward-compatible `thenkiriDl`) reads one public movie or series page. The result includes `title`, `description`, `poster`, `canonicalUrl`, `sources`, `seasons`, and `episodes`. Each episode retains its source URL and `locked`/`available` state; every page-listed source is marked `authorization: "unverified"`.
- `thenkiriEpisode(url, { seasonNumber, episodeNumber, sourceUrl, seriesUrl, parentUrl, signal, headers })` returns one episode record, enriched with its series title, poster, description, and series URL. Use a Thenkiri page URL and enough selectors to identify one episode; an ambiguous or missing selection errors rather than selecting a different episode. Locked or unavailable episodes are returned with `locked`/`available` flags—check those flags before using `sourceUrl`; page-based Download, Stream, and Download Link selections reject locked/unavailable sources.
- `thenkiriDownload(url, destination, options)` (or `thenkiriDownload(url, { dest, ...options })`) downloads through the existing `downloadTo` streaming/temporary-file saver and resolves to the destination path. `thenkiriSave` remains available. A movie/series page without an episode selector uses its first available public source; pass an episode's `sourceUrl` to select it explicitly. Options include `sourceUrl`, `seasonNumber`, `episodeNumber`, `signal`, `timeoutMs`, `headers`, and an optional caller-provided `resolveSource`.
- `thenkiriGetLink(url, options)` performs the public source-resolution workflow and media inspection but does not download the media body. It returns `{ url, type, format, quality, title, episode, season, originalUrl, sourceUrl, headers, contentLength, expiresAt, info }`. `quality` and `expiresAt` are null unless exposed by the page/URL. A null expiry does **not** mean a signed link will remain valid. The returned headers may contain a host-scoped session cookie; keep them private and use them only with the returned URL.
- `thenkiriStream(url, options)` resolves the public source, fetches its media response, checks the MIME type and a recognized video-container signature, and returns `{ stream, filename, info, url, headers, contentType, contentLength }`. `stream` is a Web `ReadableStream<Uint8Array>` and is not saved to disk. This byte-stream method supports directly served MP4/MOV, Matroska/WebM, MPEG-TS, FLV, and Ogg video containers. HLS/DASH playlist links can be returned by `thenkiriGetLink()` for a compatible external player, but are not represented as playable byte streams by `thenkiriStream()`.

Search and detail/catalog operations do not inspect media or download files. Download Link performs a metadata/HEAD or bounded range inspection to verify media content before returning a URL. Download and Stream accept either a Thenkiri page, a direct media URL, or a public DownloadWella URL. For series pages, select the episode explicitly with `{ seasonNumber, episodeNumber }` or pass the episode's `sourceUrl`.

All network methods accept `signal` for cancellation; `timeoutMs` bounds source resolution and stream opening (default 20 seconds), while the full download transfer is bounded by `downloadTimeoutMs` (default 120 seconds). A stream's lifetime after its first validated bytes is controlled by the consumer and optional abort signal. Invalid/expired links, unsupported media, locked/unavailable episodes, timeouts, and provider errors reject with a descriptive error. Form submission is one-shot: social-dl does not retry an ambiguous POST, and it does not bypass CAPTCHA/browser verification, login, payment, DRM, or other access controls. No additional installation step is needed beyond `npm install social-dl`; the existing package requires Node.js 18+.

Thenkiri is an independent public source, not affiliated with social-dl. Extracted `sourceAttribution` identifies **TheNkiri.com as the source of page metadata and link listings**; it does not claim that Thenkiri created or owns the film, episode, poster, or other third-party material. Generic `universalSave()` retains its explicit per-source authorization callback requirement for Thenkiri sources.

**Use, credit, and redistribution:** social-dl is an independent public package and is not endorsed by or affiliated with Thenkiri. Do not present Thenkiri as the owner or creator of a film merely because its page linked to it. Do not sell, publish, or redistribute media obtained through a provider unless the relevant rights holder or license explicitly permits that use. A source credit, a non-ownership disclaimer, or an intention not to sell does not grant download or redistribution rights; use the provider only for media you own or are specifically authorized to download.

The public DownloadWella form is submitted once using the fields present in its public HTML form. Cookies are restricted by domain, path, and Secure attributes; redirects are checked manually and capped. Verification pages, expired links, invalid media, and unsafe redirects fail closed. No private form values, cookies, or tokens are documented here. The provider may change its public form or link behavior; tests use sanitized fixtures and locally generated media, while live availability is outside the package's control.

## Error handling

Handle `BotDetectedError` for provider anti-automation blocks, `PrivateError` for login/private content, `NotFoundError` for missing media, `NoConfidentMatchError` when a Spotify audio match is not strong enough, and `UnsupportedError` for unsupported URLs.

## Demo

<!-- DEMO TODO FOR 1.0.0: After publishing 0.9.0, record terminal and replace with ![demo](./demo.gif) -->

Demo video coming in 1.0.0 — npx becomes available after this 0.9.0 pre-launch.

## Release checklist

Before publishing a new npm version:

```bash
npm test
npm pack --dry-run
npx social-dl doctor
```

The package requires Node.js 18 or newer. MP3 conversion requires FFmpeg. Provider availability can change independently of social-dl, so login-required or blocked sources should be tested with permitted cookies or a proxy.

## License

Proprietary license. See [LICENSE](./LICENSE).
> created and maintained by crysnovax • @plogme please this has no promotional intent or unofficial bridge of any sort. do not missus this package.

## Stable v1 service facade (1.4.2 additive API)

The 1.4.2 facade is an additive library layer. Existing direct downloads, streaming, catalog, queue, CLI, provider, and fallback functions remain available unchanged. Import `social-dl/api` or the package root:

```js
import { createService, createUrlStreamSession, normalizeUrl, urlIdentity } from 'social-dl';
const service = createService({ watchPath: '.watch.json', jobs: { path: '.jobs.json' } });
const job = await service.jobs.submit('https://example.test/public.mp4', { maxRetries: 2 });
service.jobs.on('progress', event => console.log(event.job.id, event.job.progress, event.job.etaMs));
```

The facade provides stable `API_VERSION === "v1"`, normalized URL identity, machine-readable `ApiError` codes, persistent job IDs, progress/status events, retries, cancellation, and job history. Jobs are local JSON state and do not upload credentials or media. Use `JobManager` with a custom runner for applications that need a download destination; the default runner preserves the existing metadata resolver path.

`createUrlStreamSession()` creates a social-dl-owned stream session. Sessions can be opened, refreshed after provider URL expiry, and closed. `proxyUrl()` only returns a URL resolved by that session and rejects private/loopback or unrelated hosts; arbitrary proxy targets are not accepted. No DRM, CAPTCHA, login, payment, locked-episode, or provider access-control bypass is implemented.

Subtitles are normalized to language aliases (`English`, `eng`, and `en-US` become `en`), default-track flags, and safe `vtt`/`srt` formats. Artwork is normalized to a primary URL plus deduplicated URL list. `aggregateCatalogSearch()` queries selected providers independently, deduplicates by normalized URL identity, and returns partial failures rather than hiding them. `normalizeSeries()` adds stable series and episode IDs without changing the legacy result fields. `WatchProgressStore` persists local position, duration, completion, and updated-at values.

Provider diagnostics are available through `providerHealth()`, `extractProviderMetadata()`, `providerConcurrency()`, and `ProviderLimiter`. Provider defaults are conservative and can be overridden by callers. Deterministic fixtures and focused tests live in `tests/fixtures/` and `tests/enhancements.test.js`.

```bash
npm test
npm run test:enhancements
npm run check
npm pack --dry-run
```

If a catalog clickout itself looks like a media file, it is marked `destinationType: "media-candidate"` and kept out of provider-watch results. That label is not a verified stream or a direct-download link: social-dl does not place it in `formats`, set `manifestUrl`, or download it until the source and exact title association are validated. A provider page that embeds a stream remains distinct from a provider-authorized download; no DRM, sign-in, subscription, geoblocking, or ad controls are bypassed.
