@coflyn/mori 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to the Mori CLI (`@coflyn/mori`) will be documented in this
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.1] - 2026-11-17
9
+
10
+ ### Fixed
11
+ - **YouTube Shorts & Query Normalization**:
12
+ - Convert YouTube Shorts links (`/shorts/{id}`) to standard `/watch?v={id}` URLs before resolving.
13
+ - Distinguish between single videos and playlists when both `v=` and `list=` parameters exist in the URL.
14
+ - Fix converter download headers when redirected to `.shop` mirror domains.
15
+ - **Playlist & Multi-Track Album Downloads**:
16
+ - Automatically detect playlists and multi-track albums (YouTube, Spotify, Apple Music, Bandcamp).
17
+ - Add interactive prompt to download all tracks or select specific tracks.
18
+ - Save files with real track titles and index prefixes (`01. Artist - Title.mp3`) instead of generic playlist names.
19
+ - Support automatic full playlist download with `--yes` (`-y`).
20
+
8
21
  ## [1.2.0] - 2026-10-25
9
22
 
10
23
  ### Added
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  <h1 align="center">@coflyn/mori</h1>
3
3
  <p align="center"><strong>Universal Media Downloader CLI</strong></p>
4
4
  <p align="center"><em>Save anything, from anywhere. No watermarks. No tracking.</em></p>
5
+ <p align="center"><strong>English</strong> · <a href="translations/README-zh-CN.md">简体中文</a> · <a href="translations/README-id.md">Bahasa Indonesia</a></p>
5
6
  </p>
6
7
 
7
8
  <p align="center">
@@ -17,24 +18,27 @@
17
18
 
18
19
  ---
19
20
 
20
- Command-line interface for **[Mori](https://github.com/coflyn/Mori)**. Download watermark-free videos, high-resolution photos, music, playlists, and compile albums into PDF across 16 platforms directly from your terminal.
21
+ Command-line interface for **[Mori](https://github.com/coflyn/Mori)**. Download watermark-free videos, photos, audio, full playlists, and compile photo galleries into PDF files across 27 platforms directly from your terminal.
21
22
 
22
- ## ⚡ Quick Start
23
+ ## Quick Start
23
24
 
24
- Run instantly without global installation via `npx`:
25
+ Run directly without global installation:
25
26
 
26
27
  ```bash
27
28
  # Interactive REPL mode
28
29
  npx @coflyn/mori
29
30
 
30
- # Download any link directly
31
- npx @coflyn/mori https://www.tiktok.com/@user/video/123456789
31
+ # Download a link directly
32
+ npx @coflyn/mori "https://www.tiktok.com/@user/video/123456789"
32
33
 
33
34
  # Download audio only (MP3)
34
- npx @coflyn/mori https://youtu.be/dQw4w9WgXcQ -a
35
+ npx @coflyn/mori "https://youtu.be/dQw4w9WgXcQ" -a
35
36
 
36
- # Compile photo carousel into a single PDF album
37
- npx @coflyn/mori https://www.instagram.com/p/C_abc123/ -p
37
+ # Download an entire playlist or album automatically
38
+ npx @coflyn/mori "https://www.youtube.com/playlist?list=PLxxx" -y
39
+
40
+ # Compile photo carousel into a single PDF
41
+ npx @coflyn/mori "https://www.instagram.com/p/C_abc123/" -p
38
42
  ```
39
43
 
40
44
  Or install globally:
@@ -46,32 +50,20 @@ mori
46
50
 
47
51
  ---
48
52
 
49
- ## 🌐 Supported Platforms & Media
50
-
51
- | Platform | Capabilities |
52
- | :------------------------ | :---------------------------------------------------------- |
53
- | **TikTok** | No-watermark video (HD/1080p), MP3 audio, slide photos |
54
- | **Instagram** | Reels, stories, posts, photos, carousels |
55
- | **YouTube** | MP4 video, MP3 audio, full playlists & albums |
56
- | **Twitter / X** | All resolutions, GIFs, MP4 video |
57
- | **Spotify** | Single tracks, full albums & playlists to MP3 (128–320kbps) |
58
- | **Apple Music** | Tracks, albums, and playlists to high-quality MP3 |
59
- | **Pinterest** | Original full-resolution images, video pins |
60
- | **Facebook** | Public reels & HD videos |
61
- | **Threads** | Videos and photo carousels |
62
- | **Reddit** | Videos with synced audio, multi-image galleries |
63
- | **Bilibili** | High-definition DASH video & audio streams |
64
- | **Douyin** | Watermark-free videos & photo carousels |
65
- | **RedNote (Xiaohongshu)** | High-res photos and videos |
66
- | **Pixiv** | Artwork galleries and animated Ugoira |
67
- | **Bandcamp** | Individual songs and full discographies |
68
- | **TeraBox** | Direct stream extraction |
69
- | **Anime** | Interactive search & episode stream resolution (Otakudesu Sub Indo, Gogoanime Sub Eng) |
70
- | **Comic / Manga** | Interactive chapter search, image extraction, and PDF compilation (Komikindo, Komiku, Asura Scans) |
53
+ ## Supported Platforms
54
+
55
+ | Category | Platforms | Supported Media |
56
+ | :--- | :--- | :--- |
57
+ | **Social & Video** | TikTok, Douyin, YouTube, Instagram, Facebook, Twitter/X, Threads, Reddit, Bilibili, Doodstream | Videos without watermarks, 1080p streams, photo posts, stories, audio |
58
+ | **Music & Audio** | Spotify, YouTube, SoundCloud, Apple Music, Bandcamp | Single tracks, full albums, discographies, playlists (MP3 128–320 kbps) |
59
+ | **Images & Art** | Pinterest, Pixiv, RedNote (Xiaohongshu) | High-resolution images, original illustration galleries, Ugoira animations |
60
+ | **Cloud & File Hosts** | TeraBox, MediaFire, Sfile, Catbox, Pixeldrain, Krakenfiles, Google Drive | Direct stream resolution, batch links, multi-file collections |
61
+ | **Resolvers & Shorteners** | SafeLinkU, Sub2Unlock, Rekonise, Stargon / Link bypassers | Gateway bypass to final media destinations |
62
+ | **Anime & Manga** | Otakudesu, Gogoanime, Komikindo, Komiku, Asura Scans | In-CLI title search, episode stream extraction, comic chapter PDF compilation |
71
63
 
72
64
  ---
73
65
 
74
- ## 🛠️ CLI Options
66
+ ## CLI Options
75
67
 
76
68
  ```text
77
69
  USAGE:
@@ -79,75 +71,63 @@ USAGE:
79
71
  npx @coflyn/mori [URL] [OPTIONS]
80
72
 
81
73
  OPTIONS:
82
- -o, --output <dir> Custom download destination (default: ~/Downloads/Mori)
83
- -s, --server <1|2> Select scraper server engine (1 = Default, 2 = Mirror)
84
- -a, --audio Extract and download audio stream only (MP3/M4A)
85
- -p, --pdf Compile multi-photo posts directly into a single PDF album
86
- -c, --clip Auto-detect and download URL from system clipboard
87
- -y, --yes Auto-confirm and download best available stream
88
- -i, --info Inspect and display media metadata only (no download)
89
- -u, --update Check and apply latest OTA scraper patches
90
- -h, --help Show help and usage documentation
91
- -v, --version Display CLI version
74
+ -o, --output <dir> Download directory (default: ~/Downloads/Mori)
75
+ -e, --engine <auto|mori|scrapr> Scraper engine selector (default: auto)
76
+ -s, --server <1|2> Select server mirror (TikTok, IG, YouTube, X, Spotify)
77
+ -a, --audio Download audio stream only (MP3/M4A)
78
+ -p, --pdf Compile photo galleries into a single PDF document
79
+ -c, --clip Download link copied to system clipboard
80
+ -y, --yes Download without prompts (auto-selects best stream or all playlist tracks)
81
+ -i, --info Inspect media details and stream list without downloading
82
+ -u, --update Check for package updates and OTA scraper patches
83
+ -h, --help Show help and usage guide
84
+ -v, --version Show version number
92
85
  ```
93
86
 
94
87
  ---
95
88
 
96
- ## 💬 Interactive Shell & Slash Commands
97
-
98
- Launch `mori` without arguments to enter the interactive CLI shell:
99
-
100
- ```bash
101
- mori
102
- ```
103
-
104
- Inside the interactive prompt, type `/` to access built-in tools:
105
-
106
- | Command | Aliases | Description |
107
- | :--------------- | :------------ | :--------------------------------------------------------------------------------- |
108
- | `/clip` | `/paste` | Auto-detect and download media link currently on system clipboard |
109
- | `/audio [url]` | `/mp3` | Extract and download audio stream only (MP3/M4A) |
110
- | `/pdf [url]` | — | Compile photo carousel or gallery directly into a single PDF album |
111
- | `/batch` | — | Bulk-download multiple links at once (space or newline separated) |
112
- | `/play [num]` | — | Open and play downloaded MP4/MP3 media in your default system player |
113
- | `/history [num]` | — | View download history, re-download (`/history <num>`), or purge (`/history clear`) |
114
- | `/delete [num]` | `/del`, `/rm` | Remove item from history with prompt to delete file from disk |
115
- | `/open` | — | Open download folder in your OS file manager (Finder / File Explorer) |
116
- | `/dir [path]` | — | View or set default download destination folder permanently |
117
- | `/server` | — | Select default scraper engine (`auto`, `1`, `2`) |
118
- | `/info [url]` | `/inspect` | Inspect media details and available streams without downloading |
119
- | `/retry` | `/again` | Re-download the last processed link |
120
- | `/ping [host]` | — | Test network latency and packet loss (default: 1.1.1.1) |
121
- | `/stats` | — | View total files downloaded, disk space used, and platform breakdown |
122
- | `/platforms` | `/platform` | List all 16 supported media platforms and categories |
123
- | `/config` | — | Display active configuration, storage paths, and versions |
124
- | `/update` | `/u` | Check for both CLI package updates (npm) and OTA scraper patches |
125
- | `/reset` | — | Factory reset Mori configuration, cached scrapers, and history |
126
- | `/clear` | `/cls` | Clear terminal screen and reprint header |
127
- | `/help` | `/?` | Display quick command reference guide |
128
- | `/exit` | `/quit`, `/q` | Exit interactive CLI mode |
89
+ ## Interactive Shell & Slash Commands
90
+
91
+ Running `mori` with no arguments starts the interactive prompt. Type a URL or title to start, or use `/` commands:
92
+
93
+ | Command | Aliases | Description |
94
+ | :--- | :--- | :--- |
95
+ | `/clip` | `/paste` | Read and download URL from system clipboard |
96
+ | `/audio [url]` | `/mp3` | Download audio stream only (MP3/M4A) |
97
+ | `/pdf [url]` | — | Compile photo carousel into a single PDF album |
98
+ | `/batch` | — | Download multiple links at once (space or newline separated) |
99
+ | `/play [num]` | — | Open downloaded file in your default system media player |
100
+ | `/history [num]` | — | View history, re-download an item, or clear (`/history clear`) |
101
+ | `/delete` | `/del`, `/rm` | Interactive multiselect deletion (remove from history or delete from disk) |
102
+ | `/open` | — | Open Mori download folder in Finder or File Explorer |
103
+ | `/dir [path]` | — | View or change default download directory |
104
+ | `/server` | — | Change default scraper server mirror |
105
+ | `/engine` | — | Switch between Mori Engine, Scrapr Engine, or Auto mode |
106
+ | `/rollback` | — | Revert scraper engine to an earlier commit or release |
107
+ | `/info [url]` | `/inspect` | Print stream details without downloading |
108
+ | `/retry` | `/again` | Re-run last processed download |
109
+ | `/ping [host]` | — | Ping network host to test connection (default: 1.1.1.1) |
110
+ | `/stats` | — | Show total downloads, storage used, and platform statistics |
111
+ | `/platforms` | `/platform` | List all 27 supported platforms |
112
+ | `/config` | — | Print active configuration, directory paths, and versions |
113
+ | `/update` | `/u` | Check for npm CLI updates and OTA scraper patches from GitHub |
114
+ | `/reset` | — | Reset Mori configuration and history to defaults |
115
+ | `/clear` | `/cls` | Clear terminal screen |
116
+ | `/help` | `/?` | Display commands reference |
117
+ | `/exit` | `/quit`, `/q` | Exit CLI |
129
118
 
130
119
  ---
131
120
 
132
- ## 🚀 Key Features
133
-
134
- - **16 Platforms Supported**: Save media from TikTok, Instagram, YouTube, Twitter/X, Spotify, Apple Music, Pinterest, Facebook, Threads, Reddit, Bilibili, Douyin, RedNote, Pixiv, Bandcamp, and TeraBox.
135
- - **Automatic Version Checker**: Fast, non-blocking check on launch alerts you with a notification box whenever a newer CLI release is available on npm.
136
- - **Dual Update System**: Run `/update` to check for both newer CLI package versions on npm and live OTA scraper engine patches from GitHub.
137
- - **Multi-Processing Parallel Downloads**: High-speed concurrent downloads for photo galleries and batch links with optimized worker pools.
138
- - **Single-Row In-Place Updates**: Dynamic in-place terminal spinner without spamming new lines for every photo.
139
- - **Instant Photo-to-PDF**: Combine multi-image posts and photo carousels into a single, clean PDF file (`-p` / `--pdf`).
140
- - **Integrated Terminal Player**: Launch and listen/watch downloaded videos and audio directly via `/play <num>`.
141
- - **History & Disk Sync Deletion**: Keep track of downloaded files, re-download past items, or delete files from disk and history via `/delete <num>`.
142
- - **Clipboard Detection**: One-command downloads from your clipboard (`-c` / `--clip` or `/clip`).
143
- - **Dual-Server Redundancy**: Seamlessly switch between primary and mirror servers for platforms like TikTok, Instagram, YouTube, X, and Spotify.
144
- - **Over-The-Air (OTA) Hot-Patching**: Scrapers update dynamically via GitHub when upstream platform APIs change, without waiting for an NPM package release.
145
- - **Built-in Network Diagnostics**: Check connection latency and packet loss to download servers using `/ping`.
146
- - **100% Local & Private**: No analytics, no accounts, and no data telemetry. Configuration and history are stored locally in `~/.mori`.
121
+ ## Technical Details
122
+
123
+ - **Dual-Engine Architecture**: Mori uses an internal core scraper bundle and can fall back to the standalone Scrapr engine when upstream sites change their layouts.
124
+ - **OTA Patching**: Scraper logic can update via GitHub commits without waiting for a new npm release. Run `/update` or `/rollback` to manage versions.
125
+ - **Playlist & Album Queue**: Pasting a YouTube playlist, Spotify album, or Apple Music collection shows track numbers and titles, letting you download everything sequentially or pick individual tracks.
126
+ - **Local Storage**: Configuration and history stay on your machine in `~/.mori`. No analytics or telemetry.
147
127
 
148
128
  ---
149
129
 
150
- ## 📄 License
130
+ ## License
151
131
 
152
- Licensed under the [GNU General Public License v3.0](https://github.com/coflyn/Mori/blob/main/LICENSE).
132
+ Licensed under the [GNU General Public License v3.0](https://github.com/coflyn/Mori/blob/main/LICENSE).
153
133
  Part of the **[Mori](https://github.com/coflyn/Mori)** project.
package/engine.js CHANGED
@@ -58,7 +58,13 @@ function serializeData(obj) {
58
58
  }
59
59
 
60
60
  function cleanUrl(u) {
61
- return u ? u.split("?")[0] : "";
61
+ if (!u) return "";
62
+ const clean = u.split("?")[0];
63
+ const shortsMatch = clean.match(/(?:youtube\.com\/shorts\/|youtu\.be\/)([^"&?/\s]{11})/i);
64
+ if (shortsMatch) {
65
+ return `https://www.youtube.com/watch?v=${shortsMatch[1]}`;
66
+ }
67
+ return clean;
62
68
  }
63
69
 
64
70
  const SAFARI_MOBILE_UA = CHROME_MOBILE_UA;
@@ -1362,21 +1368,30 @@ export async function scrapeWithMori(url, platform, serverPreference = "auto") {
1362
1368
  break;
1363
1369
  }
1364
1370
  case "youtube": {
1371
+ const videoMatch = url.match(
1372
+ /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i,
1373
+ );
1374
+ const isPlaylist =
1375
+ url.includes("list=") && (!videoMatch?.[1] || url.includes("/playlist"));
1376
+ const targetUrl =
1377
+ !isPlaylist && videoMatch?.[1]
1378
+ ? `https://www.youtube.com/watch?v=${videoMatch[1]}`
1379
+ : url;
1365
1380
  if (srv === "server2") {
1366
1381
  scrapers.setYouTubeSource("mobi");
1367
- res = await scrapers.scrapeYouTube(url);
1382
+ res = await scrapers.scrapeYouTube(targetUrl);
1368
1383
  usedServer = "ytmp3.mobi";
1369
1384
  } else if (srv === "server1") {
1370
1385
  scrapers.setYouTubeSource("gg");
1371
- res = await scrapers.scrapeYouTube(url);
1386
+ res = await scrapers.scrapeYouTube(targetUrl);
1372
1387
  usedServer = "ytmp3.gg";
1373
1388
  } else {
1374
1389
  scrapers.setYouTubeSource("gg");
1375
- res = await scrapers.scrapeYouTube(url);
1390
+ res = await scrapers.scrapeYouTube(targetUrl);
1376
1391
  usedServer = "ytmp3.gg";
1377
1392
  if (!res?.status) {
1378
1393
  scrapers.setYouTubeSource("mobi");
1379
- res = await scrapers.scrapeYouTube(url);
1394
+ res = await scrapers.scrapeYouTube(targetUrl);
1380
1395
  usedServer = "ytmp3.mobi";
1381
1396
  }
1382
1397
  }
@@ -1574,17 +1589,26 @@ export async function scrapeWithScrapr(
1574
1589
  break;
1575
1590
  }
1576
1591
  case "youtube": {
1592
+ const videoMatch = url.match(
1593
+ /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|shorts|live)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/i,
1594
+ );
1595
+ const isPlaylist =
1596
+ url.includes("list=") && (!videoMatch?.[1] || url.includes("/playlist"));
1597
+ const targetUrl =
1598
+ !isPlaylist && videoMatch?.[1]
1599
+ ? `https://www.youtube.com/watch?v=${videoMatch[1]}`
1600
+ : url;
1577
1601
  if (srv === "ytmp3gg" || srv === "server1") {
1578
- res = await scrapr.youtube.ytmp3gg(url);
1602
+ res = await scrapr.youtube.ytmp3gg(targetUrl);
1579
1603
  usedServer = "ytmp3.gg";
1580
1604
  } else if (srv === "ytmp3" || srv === "server2") {
1581
- res = await scrapr.youtube.ytmp3(url);
1605
+ res = await scrapr.youtube.ytmp3(targetUrl);
1582
1606
  usedServer = "ytmp3";
1583
1607
  } else {
1584
- res = await scrapr.youtube.ytmp3gg(url);
1608
+ res = await scrapr.youtube.ytmp3gg(targetUrl);
1585
1609
  usedServer = "ytmp3.gg";
1586
1610
  if (!res?.status) {
1587
- res = await scrapr.youtube.ytmp3(url);
1611
+ res = await scrapr.youtube.ytmp3(targetUrl);
1588
1612
  usedServer = "ytmp3";
1589
1613
  }
1590
1614
  }
@@ -1977,50 +2001,231 @@ export async function resolveUrl(url, onStatus) {
1977
2001
  return foundLink;
1978
2002
  }
1979
2003
 
1980
- if (url.startsWith("spotidown_resolve:")) {
2004
+ if (
2005
+ url.startsWith("spotidown_resolve:") ||
2006
+ url.startsWith("soundloaders_resolve:")
2007
+ ) {
1981
2008
  if (onStatus) onStatus("Resolving Spotify direct track...");
1982
- const parts = url.replace("spotidown_resolve:", "").split("|||");
1983
- const payloadStr = parts[0];
1984
- let cookiesStr = parts[1] ? decodeURIComponent(parts[1]) : "";
1985
-
1986
- const reqHeaders = {
1987
- "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
1988
- "User-Agent": CHROME_UA,
1989
- "X-Requested-With": "XMLHttpRequest",
1990
- Referer: "https://spotidown.app/",
1991
- Origin: "https://spotidown.app",
1992
- };
1993
- if (cookiesStr) reqHeaders["Cookie"] = cookiesStr;
2009
+ function createMultipartBody(fields) {
2010
+ const boundary =
2011
+ "----WebKitFormBoundary" + Math.random().toString(36).substring(2);
2012
+ let body = "";
2013
+ for (const [k, v] of Object.entries(fields)) {
2014
+ if (v !== undefined && v !== null) {
2015
+ body += `--${boundary}\r\nContent-Disposition: form-data; name="${k}"\r\n\r\n${v}\r\n`;
2016
+ }
2017
+ }
2018
+ body += `--${boundary}--\r\n`;
2019
+ return {
2020
+ body,
2021
+ contentType: `multipart/form-data; boundary=${boundary}`,
2022
+ };
2023
+ }
1994
2024
 
1995
- const res = await scraperFetch({
1996
- url: "https://spotidown.app/action/track",
1997
- method: "POST",
1998
- headers: reqHeaders,
1999
- data: payloadStr,
2000
- rawResponse: true,
2001
- });
2002
- let dd = res?.data ?? res;
2003
- if (typeof dd === "string") {
2025
+ const isSoundloaders = url.startsWith("soundloaders_resolve:");
2026
+ const parts = url
2027
+ .replace("spotidown_resolve:", "")
2028
+ .replace("soundloaders_resolve:", "")
2029
+ .split("|||");
2030
+ let dataVal = parts[0] || "";
2031
+ let tokenVal = parts[1] || "";
2032
+ let baseVal = parts[2] ? decodeURIComponent(parts[2]) : "";
2033
+ let cookiesStr = parts[3] ? decodeURIComponent(parts[3]) : "";
2034
+
2035
+ if (dataVal.includes("=") && (!tokenVal || !tokenVal.startsWith("http"))) {
2004
2036
  try {
2005
- dd = JSON.parse(dd);
2037
+ const sp = new URLSearchParams(dataVal);
2038
+ if (sp.has("data")) dataVal = sp.get("data") || "";
2039
+ if (sp.has("token")) tokenVal = sp.get("token") || "";
2040
+ if (sp.has("base")) baseVal = sp.get("base") || "";
2041
+ if (parts[1]) cookiesStr = decodeURIComponent(parts[1]);
2006
2042
  } catch (_) {}
2007
2043
  }
2008
- let dlHtml = (typeof dd === "object" ? dd?.data || dd?.html : dd) || "";
2009
- const parser = new DOMParser();
2010
- const doc = parser.parseFromString(dlHtml, "text/html");
2044
+
2011
2045
  let foundLink = "";
2012
- doc.querySelectorAll("a").forEach((a) => {
2013
- const href = a.getAttribute("href");
2014
- const text = a.textContent.trim();
2015
- if (
2016
- href &&
2017
- href.startsWith("http") &&
2018
- !href.includes("premium.html") &&
2019
- text !== "Download Another Song"
2020
- ) {
2021
- if (!foundLink) foundLink = href;
2046
+
2047
+ // 1. If Soundloaders, try Spotimate first (if it doesn't fail with turnstile token)
2048
+ if (isSoundloaders && !tokenVal.startsWith("bccpF:")) {
2049
+ try {
2050
+ if (!cookiesStr) {
2051
+ try {
2052
+ const rHome = await scraperFetch({
2053
+ url: "https://spotimate.app/en1",
2054
+ headers: { "User-Agent": CHROME_UA },
2055
+ rawResponse: true,
2056
+ });
2057
+ let freshCookies = getCookiesFromHeaders(rHome.headers) || "";
2058
+ const rVerify = await scraperFetch({
2059
+ url: "https://spotimate.app/api/userverify",
2060
+ method: "POST",
2061
+ data: "url=" + encodeURIComponent(baseVal || "https://open.spotify.com"),
2062
+ headers: {
2063
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
2064
+ "User-Agent": CHROME_UA,
2065
+ Referer: "https://spotimate.app/en1",
2066
+ Origin: "https://spotimate.app",
2067
+ ...(freshCookies ? { Cookie: freshCookies } : {}),
2068
+ },
2069
+ rawResponse: true,
2070
+ });
2071
+ const vCookies = getCookiesFromHeaders(rVerify.headers);
2072
+ if (vCookies) freshCookies = freshCookies ? `${freshCookies}; ${vCookies}` : vCookies;
2073
+ if (freshCookies) cookiesStr = freshCookies;
2074
+ } catch (_) {}
2075
+ }
2076
+
2077
+ const mp = createMultipartBody({
2078
+ data: dataVal,
2079
+ token: tokenVal,
2080
+ track_token: tokenVal,
2081
+ ...(baseVal ? { base: baseVal } : {}),
2082
+ });
2083
+ const slHeaders = {
2084
+ "Content-Type": mp.contentType,
2085
+ "User-Agent": CHROME_UA,
2086
+ Referer: "https://spotimate.app/en1",
2087
+ Origin: "https://spotimate.app",
2088
+ };
2089
+ if (cookiesStr) slHeaders["Cookie"] = cookiesStr;
2090
+
2091
+ const res = await scraperFetch({
2092
+ url: "https://spotimate.app/action/track",
2093
+ method: "POST",
2094
+ headers: slHeaders,
2095
+ data: mp.body,
2096
+ rawResponse: true,
2097
+ });
2098
+ let dd = res?.data ?? res;
2099
+ if (typeof dd === "string") {
2100
+ try {
2101
+ dd = JSON.parse(dd);
2102
+ } catch (_) {}
2103
+ }
2104
+ let dlHtml = (typeof dd === "object" ? dd?.html || dd?.data : dd) || "";
2105
+ const parser = new DOMParser();
2106
+ const doc = parser.parseFromString(dlHtml, "text/html");
2107
+ doc.querySelectorAll("a").forEach((a) => {
2108
+ const href = a.getAttribute("href")?.trim();
2109
+ const text = a.textContent.trim();
2110
+ if (
2111
+ href &&
2112
+ href.startsWith("http") &&
2113
+ !href.includes("tunecable.com") &&
2114
+ !href.includes("premium") &&
2115
+ !text.toLowerCase().includes("cover") &&
2116
+ !href.includes("scdn.co") &&
2117
+ text !== "Download Another Song"
2118
+ ) {
2119
+ if (!foundLink) foundLink = href;
2120
+ }
2121
+ });
2122
+ if (!foundLink) {
2123
+ const match =
2124
+ dlHtml.match(
2125
+ /href=["'](https:\/\/(?:dl\.spotimate\.app|dl\.soundloaders\.app)[^"']+)["']/,
2126
+ ) ||
2127
+ dlHtml.match(
2128
+ /href=["'](https:\/\/[^"']*(?:cdnv1|\/v1\?token=)[^"']+)["']/,
2129
+ );
2130
+ if (match && match[1]) {
2131
+ foundLink = match[1];
2132
+ }
2133
+ }
2134
+ } catch (_) {}
2135
+ }
2136
+
2137
+ // 2. If SpotiDown or Spotimate fallback needed:
2138
+ if (!foundLink && baseVal) {
2139
+ let spData = dataVal;
2140
+ let spToken = tokenVal;
2141
+ let spBase = baseVal;
2142
+ let spCookies = cookiesStr;
2143
+
2144
+ // If came from Soundloaders, we need genuine SpotiDown tokens
2145
+ if (isSoundloaders || !spData || !spToken || spToken.startsWith("bccpF:")) {
2146
+ try {
2147
+ const rSession = await scraperFetch({
2148
+ url: "https://spotidown.app/action",
2149
+ method: "POST",
2150
+ data: `url=${encodeURIComponent(baseVal)}&g-recaptcha-response=dummy_token`,
2151
+ headers: {
2152
+ "Content-Type":
2153
+ "application/x-www-form-urlencoded; charset=UTF-8",
2154
+ "User-Agent": CHROME_UA,
2155
+ "X-Requested-With": "XMLHttpRequest",
2156
+ Origin: "https://spotidown.app",
2157
+ Referer: "https://spotidown.app/",
2158
+ },
2159
+ rawResponse: true,
2160
+ });
2161
+ const freshCookies = getCookiesFromHeaders(rSession.headers) || "";
2162
+ if (freshCookies) spCookies = freshCookies;
2163
+ let rData = rSession?.data;
2164
+ if (typeof rData === "string") {
2165
+ try {
2166
+ rData = JSON.parse(rData);
2167
+ } catch (_) {}
2168
+ }
2169
+ const html = rData?.data || rData?.html || "";
2170
+ const parser = new DOMParser();
2171
+ const doc = parser.parseFromString(html, "text/html");
2172
+ const form = doc.querySelector('form[name="submitspurl"]');
2173
+ if (form) {
2174
+ spData = form.querySelector('input[name="data"]')?.value || "";
2175
+ spToken = form.querySelector('input[name="token"]')?.value || "";
2176
+ spBase = form.querySelector('input[name="base"]')?.value || baseVal;
2177
+ }
2178
+ } catch (_) {}
2022
2179
  }
2023
- });
2180
+
2181
+ if (spData && spToken) {
2182
+ const mp = createMultipartBody({
2183
+ data: spData,
2184
+ base: spBase,
2185
+ token: spToken,
2186
+ });
2187
+
2188
+ const reqHeaders = {
2189
+ "Content-Type": mp.contentType,
2190
+ "User-Agent": CHROME_UA,
2191
+ "X-Requested-With": "XMLHttpRequest",
2192
+ Referer: "https://spotidown.app/",
2193
+ Origin: "https://spotidown.app",
2194
+ };
2195
+ if (spCookies) reqHeaders["Cookie"] = spCookies;
2196
+
2197
+ const res = await scraperFetch({
2198
+ url: "https://spotidown.app/action/track",
2199
+ method: "POST",
2200
+ headers: reqHeaders,
2201
+ data: mp.body,
2202
+ rawResponse: true,
2203
+ });
2204
+ let dd = res?.data ?? res;
2205
+ if (typeof dd === "string") {
2206
+ try {
2207
+ dd = JSON.parse(dd);
2208
+ } catch (_) {}
2209
+ }
2210
+ let dlHtml = (typeof dd === "object" ? dd?.data || dd?.html : dd) || "";
2211
+ const parser = new DOMParser();
2212
+ const doc = parser.parseFromString(dlHtml, "text/html");
2213
+ doc.querySelectorAll("a").forEach((a) => {
2214
+ const href = a.getAttribute("href");
2215
+ const text = a.textContent.trim();
2216
+ if (
2217
+ href &&
2218
+ href.startsWith("http") &&
2219
+ !href.includes("premium.html") &&
2220
+ !href.includes("ko-fi.com") &&
2221
+ text !== "Download Another Song"
2222
+ ) {
2223
+ if (!foundLink) foundLink = href;
2224
+ }
2225
+ });
2226
+ }
2227
+ }
2228
+
2024
2229
  if (!foundLink) throw new Error("Could not resolve Spotify download link.");
2025
2230
  return foundLink;
2026
2231
  }
package/index.js CHANGED
@@ -127,6 +127,22 @@ function truncateText(str, max = 72) {
127
127
  }
128
128
 
129
129
  function formatStreamItem(d, i, allDownloads = []) {
130
+ const cleanTrack = (d.title || d.type || "")
131
+ .replace(/\s*\[(MP3|MP4|JPG|PNG|WEBP|COVER)\]/gi, "")
132
+ .trim();
133
+
134
+ const isGeneric =
135
+ !cleanTrack ||
136
+ /^(mp3|audio|music|photo|image|video|link|default)$/i.test(cleanTrack) ||
137
+ /^\d+p$/i.test(cleanTrack);
138
+
139
+ if (!isGeneric && (/^\d+\.\s+/.test(cleanTrack) || d.title)) {
140
+ return {
141
+ label: d.title || cleanTrack,
142
+ hint: (d.type || "").toLowerCase().includes("mp4") ? "video" : "audio",
143
+ };
144
+ }
145
+
130
146
  const typeStr = (d.type || "").toLowerCase();
131
147
  const qualityStr = (d.quality || "").trim();
132
148
 
@@ -390,10 +406,24 @@ async function processDownloadItem({ item, meta, outputDir, index, total }) {
390
406
  ? "jpg"
391
407
  : "mp4");
392
408
 
409
+ const cleanTrack = (item.title || item.type || "")
410
+ .replace(/\s*\[(MP3|MP4|JPG|PNG|WEBP|COVER)\]/gi, "")
411
+ .trim();
412
+ const isGenericTrack =
413
+ !cleanTrack ||
414
+ /^(mp3|audio|music|photo|image|video|link|default)$/i.test(cleanTrack) ||
415
+ /^\d+p$/i.test(cleanTrack);
416
+
417
+ const trackTitle =
418
+ !isGenericTrack && (/^\d+\.\s+/.test(cleanTrack) || item.title)
419
+ ? item.title || cleanTrack
420
+ : null;
421
+
393
422
  let baseTitle = rawFilename
394
423
  ? path.basename(rawFilename, path.extname(rawFilename))
395
- : (meta.title || "Media");
396
- if (total > 1) {
424
+ : trackTitle || meta.title || "Media";
425
+
426
+ if (total > 1 && !trackTitle) {
397
427
  baseTitle = `${baseTitle}_${index + 1}`;
398
428
  }
399
429
  const filename = sanitizeFilename(baseTitle, ext);
@@ -445,7 +475,7 @@ async function processDownloadItem({ item, meta, outputDir, index, total }) {
445
475
  );
446
476
  addToHistory({
447
477
  url: meta.url || "",
448
- title: meta.title || "Media",
478
+ title: trackTitle || meta.title || "Media",
449
479
  platform: meta.platform || "unknown",
450
480
  filename: path.basename(destPath),
451
481
  path: destPath,
@@ -636,37 +666,102 @@ async function handleScrapeAndDownload(targetUrl, options) {
636
666
  return false;
637
667
  }
638
668
 
639
- if (options.audio) {
640
- const audioItem =
641
- downloads.find(
642
- (d) =>
643
- d.type?.toLowerCase().includes("mp3") ||
644
- d.type?.toLowerCase().includes("audio") ||
645
- d.type?.toLowerCase().includes("music"),
646
- ) || downloads[0];
669
+ const isPlaylistOrAlbum =
670
+ media.type === "playlist" ||
671
+ media.type === "album" ||
672
+ /playlist|album/i.test(targetUrl || "") ||
673
+ /playlist|album/i.test(media.sourceUrl || "") ||
674
+ /playlist|album/i.test(media.originalUrl || "") ||
675
+ (typeof media.title === "string" &&
676
+ /\((Playlist|Album)\)/i.test(media.title));
677
+
678
+ const hasTrackNumbers = downloads.some((dl) =>
679
+ /^\d+\.\s+/.test((dl.type || dl.title || "").trim()),
680
+ );
681
+
682
+ const isPlaylistCollection =
683
+ (isPlaylistOrAlbum || hasTrackNumbers) && downloads.length > 1;
647
684
 
648
- p.log.message(
649
- `${pc.bold("● Audio Stream:")} ${pc.white(audioItem.type || "MP3")}`,
685
+ if (isPlaylistCollection) {
686
+ const audioTracks = downloads.filter(
687
+ (d) =>
688
+ !d.type?.toLowerCase().includes("cover") &&
689
+ !d.type?.toLowerCase().includes("photo"),
650
690
  );
691
+ const candidateTracks = audioTracks.length > 0 ? audioTracks : downloads;
651
692
 
652
- await processDownloadItem({
653
- item: audioItem,
654
- meta: media,
655
- outputDir,
656
- index: 0,
657
- total: 1,
658
- });
659
- return true;
660
- }
693
+ let itemsToDownload = candidateTracks;
661
694
 
662
- if (options.yes) {
663
- await processDownloadItem({
664
- item: downloads[0],
665
- meta: media,
666
- outputDir,
667
- index: 0,
668
- total: 1,
669
- });
695
+ if (!options.yes) {
696
+ const choice = await p.select({
697
+ message: `Playlist / Album detected (${candidateTracks.length} tracks):`,
698
+ options: [
699
+ {
700
+ value: "all",
701
+ label: `Download All (${candidateTracks.length} tracks)`,
702
+ },
703
+ {
704
+ value: "custom",
705
+ label: "Select specific tracks...",
706
+ },
707
+ {
708
+ value: "cancel",
709
+ label: pc.dim("Cancel"),
710
+ },
711
+ ],
712
+ });
713
+
714
+ if (p.isCancel(choice) || choice === "cancel") {
715
+ p.cancel("Cancelled.");
716
+ return false;
717
+ }
718
+
719
+ if (choice === "custom") {
720
+ const selectedIndices = await p.multiselect({
721
+ message: "Select tracks to download:",
722
+ options: candidateTracks.map((d, i) => {
723
+ const item = formatStreamItem(d, i, candidateTracks);
724
+ return {
725
+ value: i,
726
+ label: item.label,
727
+ };
728
+ }),
729
+ required: true,
730
+ });
731
+
732
+ if (p.isCancel(selectedIndices)) {
733
+ p.cancel("Cancelled.");
734
+ return false;
735
+ }
736
+
737
+ itemsToDownload = selectedIndices.map((idx) => candidateTracks[idx]);
738
+ }
739
+ }
740
+
741
+ p.log.info(
742
+ `${pc.bold("● Playlist Queue:")} Downloading ${itemsToDownload.length} track(s)...`,
743
+ );
744
+
745
+ let successCount = 0;
746
+ for (let i = 0; i < itemsToDownload.length; i++) {
747
+ const item = itemsToDownload[i];
748
+ const streamInfo = formatStreamItem(item, i, itemsToDownload);
749
+ p.log.step(
750
+ `${pc.bold(`[${i + 1}/${itemsToDownload.length}]`)} ${streamInfo.label}`,
751
+ );
752
+ const ok = await processDownloadItem({
753
+ item,
754
+ meta: media,
755
+ outputDir,
756
+ index: i,
757
+ total: itemsToDownload.length,
758
+ });
759
+ if (ok) successCount++;
760
+ }
761
+
762
+ p.log.success(
763
+ `${pc.bold("✔ Playlist completed:")} [${successCount}/${itemsToDownload.length}] tracks saved to ${pc.dim(outputDir)}`,
764
+ );
670
765
  return true;
671
766
  }
672
767
 
@@ -726,7 +821,11 @@ async function handleScrapeAndDownload(targetUrl, options) {
726
821
  let downloadAudioAlso = false;
727
822
 
728
823
  if (!albumFormat) {
729
- const albumOptions = [
824
+ if (options.yes) {
825
+ albumFormat = "all";
826
+ downloadAudioAlso = audioDownloads.length > 0;
827
+ } else {
828
+ const albumOptions = [
730
829
  {
731
830
  value: "all",
732
831
  label: `Download All (${photoDownloads.length} individual images)`,
@@ -827,6 +926,7 @@ async function handleScrapeAndDownload(targetUrl, options) {
827
926
  albumFormat = "all";
828
927
  }
829
928
  }
929
+ }
830
930
 
831
931
  if (albumFormat === "pdf") {
832
932
  const s = p.spinner();
@@ -990,6 +1090,40 @@ async function handleScrapeAndDownload(targetUrl, options) {
990
1090
 
991
1091
  return true;
992
1092
  } else {
1093
+ if (options.audio) {
1094
+ const audioItem =
1095
+ downloads.find(
1096
+ (d) =>
1097
+ d.type?.toLowerCase().includes("mp3") ||
1098
+ d.type?.toLowerCase().includes("audio") ||
1099
+ d.type?.toLowerCase().includes("music"),
1100
+ ) || downloads[0];
1101
+
1102
+ p.log.message(
1103
+ `${pc.bold("● Audio Stream:")} ${pc.white(audioItem.type || "MP3")}`,
1104
+ );
1105
+
1106
+ await processDownloadItem({
1107
+ item: audioItem,
1108
+ meta: media,
1109
+ outputDir,
1110
+ index: 0,
1111
+ total: 1,
1112
+ });
1113
+ return true;
1114
+ }
1115
+
1116
+ if (options.yes) {
1117
+ await processDownloadItem({
1118
+ item: downloads[0],
1119
+ meta: media,
1120
+ outputDir,
1121
+ index: 0,
1122
+ total: 1,
1123
+ });
1124
+ return true;
1125
+ }
1126
+
993
1127
  let selectedItem = downloads[0];
994
1128
 
995
1129
  if (downloads.length > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coflyn/mori",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Universal media downloader CLI. Save anything, from anywhere. No watermarks. No tracking.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,8 @@
13
13
  "engine.js",
14
14
  "README.md",
15
15
  "CHANGELOG.md",
16
- "LICENSE"
16
+ "LICENSE",
17
+ "translations"
17
18
  ],
18
19
  "engines": {
19
20
  "node": ">=18.0.0"
@@ -0,0 +1,133 @@
1
+ <p align="center">
2
+ <h1 align="center">@coflyn/mori</h1>
3
+ <p align="center"><strong>CLI Downloader Media Universal</strong></p>
4
+ <p align="center"><em>Download media apa saja, dari mana saja. Tanpa watermark. Tanpa pelacak.</em></p>
5
+ <p align="center"><a href="../README.md">English</a> · <a href="README-zh-CN.md">简体中文</a> · <strong>Bahasa Indonesia</strong></p>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/@coflyn/mori"><img src="https://img.shields.io/npm/v/@coflyn/mori?style=flat-square&color=blue" alt="Versi NPM"></a>
10
+ <a href="https://www.npmjs.com/package/@coflyn/mori"><img src="https://img.shields.io/npm/dm/@coflyn/mori?style=flat-square&color=green" alt="Total Download NPM"></a>
11
+ <a href="https://github.com/coflyn/Mori"><img src="https://img.shields.io/badge/License-GPL--3.0-blue?style=flat-square" alt="Lisensi"></a>
12
+ <a href="https://github.com/coflyn/Mori"><img src="https://img.shields.io/badge/GitHub-coflyn%2FMori-black?style=flat-square&logo=github" alt="GitHub"></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img src="https://raw.githubusercontent.com/coflyn/Mori/main/assets/cli.webp" width="90%" alt="Pratinjau Mori CLI">
17
+ </p>
18
+
19
+ ---
20
+
21
+ Antarmuka baris perintah (CLI) untuk **[Mori](https://github.com/coflyn/Mori)**. Download video tanpa watermark, foto beresolusi penuh, audio, seluruh isi playlist, serta satukan galeri foto menjadi file PDF dari 27 platform langsung lewat terminal.
22
+
23
+ ## Cara Pakai Cepat
24
+
25
+ Jalankan langsung tanpa perlu install global lewat `npx`:
26
+
27
+ ```bash
28
+ # Mode interaktif (REPL)
29
+ npx @coflyn/mori
30
+
31
+ # Download link langsung
32
+ npx @coflyn/mori "https://www.tiktok.com/@user/video/123456789"
33
+
34
+ # Download audio saja (MP3)
35
+ npx @coflyn/mori "https://youtu.be/dQw4w9WgXcQ" -a
36
+
37
+ # Download semua lagu di playlist atau album sekaligus
38
+ npx @coflyn/mori "https://www.youtube.com/playlist?list=PLxxx" -y
39
+
40
+ # Kompilasi postingan multi-foto menjadi satu file PDF
41
+ npx @coflyn/mori "https://www.instagram.com/p/C_abc123/" -p
42
+ ```
43
+
44
+ Atau pasang secara global di perangkat:
45
+
46
+ ```bash
47
+ npm install -g @coflyn/mori
48
+ mori
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Platform yang Didukung
54
+
55
+ | Kategori | Platform | Format yang Didukung |
56
+ | :--- | :--- | :--- |
57
+ | **Media Sosial & Video** | TikTok, Douyin, YouTube, Instagram, Facebook, Twitter/X, Threads, Reddit, Bilibili, Doodstream | Video bebas watermark, stream 1080p, postingan foto/slide, story, audio |
58
+ | **Musik & Audio** | Spotify, YouTube, SoundCloud, Apple Music, Bandcamp | Single track, album penuh, diskografi, playlist (MP3 128–320 kbps) |
59
+ | **Gambar & Ilustrasi** | Pinterest, Pixiv, RedNote (Xiaohongshu) | Gambar resolusi asli, galeri ilustrasi, animasi Ugoira |
60
+ | **Cloud & File Hosting** | TeraBox, MediaFire, Sfile, Catbox, Pixeldrain, Krakenfiles, Google Drive | Resolusi link langsung, batch link, album koleksi banyak file |
61
+ | **Shortener & Resolver** | SafeLinkU, Sub2Unlock, Rekonise, Stargon / Link bypasser | Bypass gateway menuju link file asli |
62
+ | **Anime & Manga** | Otakudesu, Gogoanime, Komikindo, Komiku, Asura Scans | Pencarian judul langsung dari CLI, stream episode, kompilasi chapter komik ke PDF |
63
+
64
+ ---
65
+
66
+ ## Opsi Perintah (Flags)
67
+
68
+ ```text
69
+ PENGGUNAAN:
70
+ mori [URL] [OPSI]
71
+ npx @coflyn/mori [URL] [OPSI]
72
+
73
+ OPSI:
74
+ -o, --output <folder> Tentukan folder download (default: ~/Downloads/Mori)
75
+ -e, --engine <auto|mori|scrapr> Pilih engine scraper (default: auto)
76
+ -s, --server <1|2> Pilih mirror server (TikTok, IG, YouTube, X, Spotify)
77
+ -a, --audio Ambil stream audio saja (MP3/M4A)
78
+ -p, --pdf Kompilasi postingan multi-foto jadi 1 file PDF
79
+ -c, --clip Ambil dan download link dari clipboard sistem
80
+ -y, --yes Download otomatis tanpa konfirmasi (ambil kualitas terbaik atau seluruh playlist)
81
+ -i, --info Lihat metadata dan daftar stream tanpa mendownload
82
+ -u, --update Cek pembaruan paket dan patch OTA scraper
83
+ -h, --help Buka panduan bantuan
84
+ -v, --version Tampilkan nomor versi
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Shell Interaktif & Perintah Slash
90
+
91
+ Menjalankan `mori` tanpa argumen akan membuka antarmuka terminal interaktif. Masukkan link atau judul anime/komik untuk mulai, atau gunakan perintah berawalan `/`:
92
+
93
+ | Perintah | Alias | Penjelasan |
94
+ | :--- | :--- | :--- |
95
+ | `/clip` | `/paste` | Ambil dan download link yang ada di clipboard |
96
+ | `/audio [url]` | `/mp3` | Download stream audio saja (MP3/M4A) |
97
+ | `/pdf [url]` | — | Gabungkan galeri foto menjadi satu file PDF |
98
+ | `/batch` | — | Download banyak tautan sekaligus (dipisah spasi atau baris baru) |
99
+ | `/play [nomor]` | — | Putar file hasil download di pemutar media bawaan komputer |
100
+ | `/history [nomor]` | — | Lihat riwayat download, download ulang, atau hapus riwayat (`/history clear`) |
101
+ | `/delete` | `/del`, `/rm` | Hapus riwayat download secara interaktif (bisa sekalian hapus file di disk) |
102
+ | `/open` | — | Buka folder hasil download di Finder atau File Explorer |
103
+ | `/dir [path]` | — | Cek atau ubah lokasi folder download default |
104
+ | `/server` | — | Ganti server mirror scraper default |
105
+ | `/engine` | — | Ganti mode engine (Mori Engine, Scrapr Engine, atau Auto) |
106
+ | `/rollback` | — | Kembalikan engine scraper ke versi atau commit sebelumnya |
107
+ | `/info [url]` | `/inspect` | Tampilkan detail stream tanpa mendownload file |
108
+ | `/retry` | `/again` | Download ulang link yang terakhir diproses |
109
+ | `/ping [host]` | — | Uji latensi jaringan dan paket hilang (default: 1.1.1.1) |
110
+ | `/stats` | — | Tampilkan statistik download, kuota disk terpakai, dan ringkasan per platform |
111
+ | `/platforms` | `/platform` | Tampilkan daftar 27 platform yang didukung |
112
+ | `/config` | — | Lihat konfigurasi aktif, lokasi penyimpanan, dan versi engine |
113
+ | `/update` | `/u` | Cek pembaruan CLI di npm dan patch OTA scraper dari GitHub |
114
+ | `/reset` | — | Kembalikan pengaturan dan riwayat Mori ke setelan awal |
115
+ | `/clear` | `/cls` | Bersihkan layar terminal |
116
+ | `/help` | `/?` | Tampilkan ringkasan perintah |
117
+ | `/exit` | `/quit`, `/q` | Keluar dari CLI |
118
+
119
+ ---
120
+
121
+ ## Detail Teknis
122
+
123
+ - **Arsitektur Dual-Engine**: Mori memakai modul scraper internal dan otomatis beralih ke engine Scrapr jika struktur halaman platform target berubah.
124
+ - **Pembaruan OTA (Over-The-Air)**: Logika scraper bisa diperbarui lewat commit GitHub tanpa harus menunggu rilis paket baru di npm. Gunakan `/update` atau `/rollback` untuk mengatur versi.
125
+ - **Antrean Playlist & Album**: Menempelkan playlist YouTube, album Spotify, atau daftar lagu Apple Music akan memunculkan nomor serta judul lagu asli. Kamu bisa memilih download semua secara berurutan atau hanya lagu tertentu.
126
+ - **Penyimpanan Lokal**: Seluruh konfigurasi dan riwayat download tersimpan di perangkat kamu (`~/.mori`). Tidak ada telemetri maupun analitik.
127
+
128
+ ---
129
+
130
+ ## Lisensi
131
+
132
+ Didistribusikan di bawah [Lisensi GNU General Public License v3.0](https://github.com/coflyn/Mori/blob/main/LICENSE).
133
+ Bagian dari proyek **[Mori](https://github.com/coflyn/Mori)**.
@@ -0,0 +1,133 @@
1
+ <p align="center">
2
+ <h1 align="center">@coflyn/mori</h1>
3
+ <p align="center"><strong>通用多媒体下载 CLI</strong></p>
4
+ <p align="center"><em>随处保存,想下就下。无水印,无追踪。</em></p>
5
+ <p align="center"><a href="../README.md">English</a> · <strong>简体中文</strong> · <a href="README-id.md">Bahasa Indonesia</a></p>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/@coflyn/mori"><img src="https://img.shields.io/npm/v/@coflyn/mori?style=flat-square&color=blue" alt="NPM 版本"></a>
10
+ <a href="https://www.npmjs.com/package/@coflyn/mori"><img src="https://img.shields.io/npm/dm/@coflyn/mori?style=flat-square&color=green" alt="NPM 下载量"></a>
11
+ <a href="https://github.com/coflyn/Mori"><img src="https://img.shields.io/badge/License-GPL--3.0-blue?style=flat-square" alt="开源协议"></a>
12
+ <a href="https://github.com/coflyn/Mori"><img src="https://img.shields.io/badge/GitHub-coflyn%2FMori-black?style=flat-square&logo=github" alt="GitHub"></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img src="https://raw.githubusercontent.com/coflyn/Mori/main/assets/cli.webp" width="90%" alt="Mori CLI 预览">
17
+ </p>
18
+
19
+ ---
20
+
21
+ **[Mori](https://github.com/coflyn/Mori)** 命令行工具。直接在终端中从 27 个主流平台下载无水印视频、高清原图、音频、整张播放列表,或将图集拼合编译为单份 PDF 文档。
22
+
23
+ ## 快速上手
24
+
25
+ 通过 `npx` 直接运行,无需全局安装:
26
+
27
+ ```bash
28
+ # 启动交互式终端模式 (REPL)
29
+ npx @coflyn/mori
30
+
31
+ # 直接下载指定链接
32
+ npx @coflyn/mori "https://www.tiktok.com/@user/video/123456789"
33
+
34
+ # 仅提取音频 (MP3)
35
+ npx @coflyn/mori "https://youtu.be/dQw4w9WgXcQ" -a
36
+
37
+ # 自动下载整张播放列表或专辑
38
+ npx @coflyn/mori "https://www.youtube.com/playlist?list=PLxxx" -y
39
+
40
+ # 将多图贴文合并为单份 PDF
41
+ npx @coflyn/mori "https://www.instagram.com/p/C_abc123/" -p
42
+ ```
43
+
44
+ 或者进行全局安装:
45
+
46
+ ```bash
47
+ npm install -g @coflyn/mori
48
+ mori
49
+ ```
50
+
51
+ ---
52
+
53
+ ## 支持的平台
54
+
55
+ | 分类 | 平台 | 支持的内容 |
56
+ | :--- | :--- | :--- |
57
+ | **社交与视频** | TikTok, 抖音, YouTube, Instagram, Facebook, Twitter/X, Threads, Reddit, 哔哩哔哩, Doodstream | 无水印视频、1080p 画质流、图片贴文、快拍、原声音频 |
58
+ | **音乐与音频** | Spotify, YouTube, SoundCloud, Apple Music, Bandcamp | 单曲、整张专辑、全集唱片、歌单播放列表 (MP3 128–320 kbps) |
59
+ | **插画与图集** | Pinterest, Pixiv, 小红书 (RedNote) | 高清原图、插画画廊、动图 Ugoira |
60
+ | **网盘与文件存储** | TeraBox, MediaFire, Sfile, Catbox, Pixeldrain, Krakenfiles, Google 云端硬盘 | 直链解析、批量下载、多文件合集 |
61
+ | **短链与跳板解析** | SafeLinkU, Sub2Unlock, Rekonise, Stargon / 网页跳转解析器 | 绕过中转页直接获取目标资源 |
62
+ | **动漫与漫画** | Otakudesu, Gogoanime, Komikindo, Komiku, Asura Scans | 终端内搜索番剧漫画、剧集流媒体解析、漫画章节导出 PDF |
63
+
64
+ ---
65
+
66
+ ## 命令行参数 (Options)
67
+
68
+ ```text
69
+ 用法:
70
+ mori [URL] [参数]
71
+ npx @coflyn/mori [URL] [参数]
72
+
73
+ 参数:
74
+ -o, --output <目录> 自定义下载目录 (默认: ~/Downloads/Mori)
75
+ -e, --engine <auto|mori|scrapr> 解析引擎选择 (默认: auto)
76
+ -s, --server <1|2> 选择服务器镜像 (TikTok, IG, YouTube, X, Spotify)
77
+ -a, --audio 仅提取并下载音频流 (MP3/M4A)
78
+ -p, --pdf 将多图贴文合并编译为单份 PDF 电子书
79
+ -c, --clip 自动读取系统剪贴板中的链接并开始下载
80
+ -y, --yes 无需确认直接下载 (自动选择最佳画质或下载整份播放列表)
81
+ -i, --info 仅查看媒体详情与可用画质流,不执行下载
82
+ -u, --update 检查包更新及 OTA 爬虫热补丁
83
+ -h, --help 显示帮助与使用指南
84
+ -v, --version 显示版本号
85
+ ```
86
+
87
+ ---
88
+
89
+ ## 交互模式与斜杠命令
90
+
91
+ 不带任何参数运行 `mori` 将进入交互式 Shell。输入链接或搜索词开始,或使用 `/` 开头的内置命令:
92
+
93
+ | 命令 | 别名 | 功能说明 |
94
+ | :--- | :--- | :--- |
95
+ | `/clip` | `/paste` | 读取系统剪贴板并下载其中的多媒体链接 |
96
+ | `/audio [url]` | `/mp3` | 仅提取并下载音频流 (MP3/M4A) |
97
+ | `/pdf [url]` | — | 将图片画廊或贴文合并为单份 PDF |
98
+ | `/batch` | — | 批量下载多个链接 (空格或换行分隔) |
99
+ | `/play [序号]` | — | 在系统默认播放器中打开并播放已下载的音视频 |
100
+ | `/history [序号]` | — | 查看下载历史、重新下载或清空历史 (`/history clear`) |
101
+ | `/delete` | `/del`, `/rm` | 交互式多选删除 (可选择仅移除历史记录或同时删除本地文件) |
102
+ | `/open` | — | 在访达 (Finder) 或文件资源管理器中打开下载目录 |
103
+ | `/dir [路径]` | — | 查看或永久修改默认下载目录 |
104
+ | `/server` | — | 切换默认爬虫镜像服务器 |
105
+ | `/engine` | — | 在 Mori 引擎、Scrapr 引擎或自动模式间切换 |
106
+ | `/rollback` | — | 将解析引擎回滚至指定历史提交或版本 |
107
+ | `/info [url]` | `/inspect` | 打印媒体详细参数与流列表,不执行下载 |
108
+ | `/retry` | `/again` | 重新下载上次处理的链接 |
109
+ | `/ping [主机]` | — | 测试网络延迟与丢包率 (默认: 1.1.1.1) |
110
+ | `/stats` | — | 查看已下载文件总数、磁盘占用及各平台统计 |
111
+ | `/platforms` | `/platform` | 列出全部 27 个支持的平台与服务 |
112
+ | `/config` | — | 查看当前配置、存储路径与版本号 |
113
+ | `/update` | `/u` | 检查 npm 模块更新及来自 GitHub 的 OTA 爬虫补丁 |
114
+ | `/reset` | — | 将所有配置与下载历史恢复至出厂默认状态 |
115
+ | `/clear` | `/cls` | 清屏并重新打印终端标识 |
116
+ | `/help` | `/?` | 显示命令参考手册 |
117
+ | `/exit` | `/quit`, `/q` | 退出交互模式 |
118
+
119
+ ---
120
+
121
+ ## 技术细节
122
+
123
+ - **双引擎架构**: 优先使用轻量内置解析核心;当目标网站页面改版时,自动回退到独立的 Scrapr 引擎。
124
+ - **OTA 热补丁机制**: 当平台接口变动时,解析逻辑可直接通过 GitHub 提交在线更新,无需等待发布新的 npm 版本。使用 `/update` 或 `/rollback` 随时管理引擎版本。
125
+ - **播放列表与专辑队列**: 粘贴 YouTube 播放列表、Spotify 专辑或 Apple Music 歌单时,终端将完整识别曲目编号与歌名,支持整单顺序下载或选择指定歌曲。
126
+ - **纯本地存储**: 配置文件与下载历史均保存在本地 `~/.mori` 中,不含任何追踪代码与数据埋点。
127
+
128
+ ---
129
+
130
+ ## 开源协议
131
+
132
+ 遵循 [GNU General Public License v3.0](https://github.com/coflyn/Mori/blob/main/LICENSE) 开源协议。
133
+ 属于 **[Mori](https://github.com/coflyn/Mori)** 项目的一部分。