dsh-movie-workbench 1.8.0 → 1.9.0
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/README.md +49 -66
- package/README.zh.md +36 -44
- package/client.js +402 -334
- package/index.js +3 -1
- package/lib/host/access.js +94 -0
- package/lib/host/config.js +111 -0
- package/lib/host/http.js +185 -0
- package/lib/host/index.js +132 -0
- package/lib/host/params.js +158 -0
- package/lib/host/pick.js +663 -0
- package/lib/host/routes/catalog.js +229 -0
- package/lib/host/routes/image.js +112 -0
- package/lib/host/routes/pages.js +469 -0
- package/lib/host/routes/torrents.js +111 -0
- package/lib/host/sources.js +225 -0
- package/lib/host.js +8 -2508
- package/lib/providers/core.js +317 -0
- package/lib/providers/douban.js +758 -0
- package/lib/providers/imdb.js +642 -0
- package/lib/providers/tmdb.js +363 -0
- package/lib/providers/torrents.js +301 -0
- package/lib/providers.js +68 -2494
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
**English** | [
|
|
1
|
+
**English** | [中文](README.zh.md)
|
|
2
2
|
|
|
3
3
|
# dsh-movie-workbench
|
|
4
4
|
|
|
@@ -9,43 +9,13 @@ DSH **Movies workbench** : Search for movies and TV series from **TMDB**, **IMDb
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- **
|
|
13
|
-
- **Trending
|
|
14
|
-
- **
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
high-score and recent-hit variants), 高分经典 and 近期热门 for 27 genres, and 冷门佳作 for
|
|
20
|
-
each genre; TV lists group 官方榜单, 年度榜单 and 高分经典 / 近期热门 for the same genres.
|
|
21
|
-
Generated charts use their first title's poster as the card cover. Open a chart to see the
|
|
22
|
-
ranked titles with the same paged infinite scroll.
|
|
23
|
-
- **Related sections on the detail page** — TMDB collections, IMDb related titles and
|
|
24
|
-
DouBan charts sit in a right-hand rail on the title page as the same compact card:
|
|
25
|
-
a cover, a name and a small meta line. A TMDB collection opens the collection page;
|
|
26
|
-
an IMDb 相关系列 card opens the related-series page in release order; each DouBan
|
|
27
|
-
收录于榜单 card opens that chart's ranked titles directly. The middle column and the
|
|
28
|
-
synopsis use the full remaining width, and the rail stacks below the title on narrow
|
|
29
|
-
panels.
|
|
30
|
-
- **Detail metadata** — the title page shows country/region, genres and runtime as small
|
|
31
|
-
tags under the rating row: DouBan details come from the subject API, TMDB details from
|
|
32
|
-
the movie endpoint, and IMDb details from its browser GraphQL endpoint. A DouBan title
|
|
33
|
-
opened from a recommendation row (which carries no year) fills its release year from
|
|
34
|
-
the same detail request.
|
|
35
|
-
- **BT resources** — search BT resources, sortable by size, seeders or downloads, with paged
|
|
36
|
-
loading (scroll or 加载更多 for the next page); copy the magnet link or open the source page.
|
|
37
|
-
- **AI resource pick** — click AI 选资源 above the BT list to open the dialog; evaluation only
|
|
38
|
-
starts when you press 开始评估. Pick a preference profile first: quality (best / balanced /
|
|
39
|
-
small size), language and subtitles, and the prompt will honour it when ranking. Switch to
|
|
40
|
-
自由模式 at the top right of the dialog to see and edit the exact prompt sent to the model
|
|
41
|
-
(the simple-mode choices are already mapped into it) and to inspect the model's raw output;
|
|
42
|
-
the required JSON answer format stays in the system prompt and is not editable. The dialog
|
|
43
|
-
footer shows the model in use and lets you switch it right there (defaults to the model set
|
|
44
|
-
in settings). The Host asks the model configured for this DSH profile (through the DSH LLM
|
|
45
|
-
service) to compare seeders, size, release quality and index reliability; a different model
|
|
46
|
-
can be chosen in the settings popover. The picked row is highlighted with an AI 推荐 badge
|
|
47
|
-
and the reason sits in a banner above the list. The answer is cached for the current title,
|
|
48
|
-
so reopening the dialog shows the previous result (and offers 重新评估).
|
|
12
|
+
- **Multi-source search** — search TMDB, IMDb and Douban together, grouped by source.
|
|
13
|
+
- **Trending and channel browse** — home rows plus per-source pages with category tabs and infinite scroll.
|
|
14
|
+
- **Douban charts** — official, annual and genre charts for movies and TV, plus movie hidden-gem charts.
|
|
15
|
+
- **Detail pages** — synopsis, metadata, related titles and chart placements.
|
|
16
|
+
- **BT resources** — search, sort, copy magnet links and open source pages.
|
|
17
|
+
- **AI resource pick** — rank BT rows with the profile's model, optional preferences and an editable prompt.
|
|
18
|
+
- **Settings** — manage data sources, the TMDB API key and the default model in one dialog.
|
|
49
19
|
|
|
50
20
|
## Installation
|
|
51
21
|
|
|
@@ -70,16 +40,24 @@ dsh plugin --profile desktop add dsh-movie-workbench
|
|
|
70
40
|
A Git URL also works:
|
|
71
41
|
`dsh plugin --profile desktop add git+https://github.com/aidc-lab/dsh-movie-workbench.git`.
|
|
72
42
|
|
|
73
|
-
##
|
|
43
|
+
## Settings dialog
|
|
74
44
|
|
|
75
|
-
The gear button
|
|
76
|
-
|
|
77
|
-
channel must stay enabled, and when only one is left the filter row collapses to that channel.
|
|
45
|
+
The gear button in the page header opens the settings dialog, which keeps every browser-side
|
|
46
|
+
preference in one place:
|
|
78
47
|
|
|
79
|
-
|
|
80
|
-
`
|
|
81
|
-
|
|
82
|
-
|
|
48
|
+
- **Data sources** — switches for TMDB, IMDb and Douban, stored in `localStorage`
|
|
49
|
+
(`dsh-movie-workbench.sources`). At least one channel must stay enabled, and when only one is
|
|
50
|
+
left the filter row collapses to that channel.
|
|
51
|
+
- **TMDB API Key** — a v3 key or a v4 read token, kept in this browser only
|
|
52
|
+
(`dsh-movie-workbench.tmdb-key`). When the Host already has a key configured the field can
|
|
53
|
+
stay empty.
|
|
54
|
+
- **Default model** — the models advertised by the profile's LLM providers (from the Host's
|
|
55
|
+
`GET /models`), used by AI resource pick; the choice lives in `localStorage`
|
|
56
|
+
(`dsh-movie-workbench.ai-model`). Models are only available when the DSH LLM service and a
|
|
57
|
+
model are configured.
|
|
58
|
+
|
|
59
|
+
Nothing is applied until you press Save; closing the dialog with ×, Escape or a click
|
|
60
|
+
outside discards the edits.
|
|
83
61
|
|
|
84
62
|
## Host API
|
|
85
63
|
|
|
@@ -91,19 +69,20 @@ The Host side (`index.js` + `lib/`) exposes a single prefix route, `/movie-workb
|
|
|
91
69
|
| `GET /search?q=&source=&lang=` | dispatch to the selected channels and return normalized results |
|
|
92
70
|
| `GET /trending?source=&lang=&limit=` | recommendation rows, or a longer list for one channel |
|
|
93
71
|
| `GET /browse?source=&category=&page=&cursor=&lang=` | one page (20 items) of a channel browse category; returns `hasMore` and, for IMDb, an opaque `next` cursor for infinite scroll |
|
|
94
|
-
| `GET /charts?source=douban&kind=movie\|tv` | one chart catalog: `movie` (default) has 3 official charts with live metadata, 10 annual charts (
|
|
72
|
+
| `GET /charts?source=douban&kind=movie\|tv` | one chart catalog: `movie` (default) has 3 official charts with live metadata, 10 annual charts (high-score / recent-hit variants for 2025–2021), 27 hidden-gem charts (one per genre) and 54 genre charts (94 total); `tv` has 3 official, 10 annual and 54 genre charts (67 total, no hidden gems) |
|
|
95
73
|
| `GET /chart?source=douban&id=&start=&count=` | one page of a chart's ranked titles; `id` is an official id, `year:<yyyy>:<S or U>`, `hidden:<genre>`, `genre:<genre>:<S or U>`, or the TV forms `tv-year:<yyyy>:<S or U>` / `tv-genre:<genre>:<S or U>` (S = high-score, U = recent hits) |
|
|
96
|
-
| `GET /detail?source=douban\|tmdb\|imdb&id=` | synopsis and metadata (country/region, genres, runtime) for a
|
|
74
|
+
| `GET /detail?source=douban\|tmdb\|imdb&id=` | synopsis and metadata (country/region, genres, runtime) for a Douban title, the collection reference of a TMDB movie, or an IMDb title's metadata |
|
|
97
75
|
| `GET /collection?source=tmdb&id=` | every part of a TMDB collection, as normalized movie results |
|
|
98
76
|
| `GET /series?source=imdb&id=` | the IMDb connection chain of one title (follows / followed by / spin-off), ordered by release year |
|
|
99
|
-
| `GET /chart?source=douban&id=collection:<id>` | one of the official charts a
|
|
77
|
+
| `GET /chart?source=douban&id=collection:<id>` | one of the official charts a Douban title is listed in, with the same ranked envelope as other charts |
|
|
100
78
|
| `GET /torrents?q=&alt=&source=&limit=&page=` | BT resource search; one page of results (`page` 1–20) plus `hasMore` for scroll loading |
|
|
101
79
|
| `GET /models` | models advertised by the profile's LLM providers, plus the current profile selection |
|
|
102
80
|
| `POST /pick` | ask the Host's AI model to choose the best of up to 30 BT rows; body `{ item, rows, lang, preferences?, prompt?, preview?, model? }` (`preferences` = `{ quality, language, subtitle }`, `prompt` overrides the generated prompt, `preview: true` returns the prompt without calling a model), returns `pick` (`{id, rank, reason}`), `picks`, `prompt`, `preferences` and `errors` (`llm_unavailable` / `llm_no_model` / `bad_preferences` / `bad_prompt` / timeout) |
|
|
103
81
|
| `GET /image?url=` | proxy posters from allowlisted image hosts |
|
|
104
82
|
|
|
105
|
-
All upstream HTTP requests happen in the Host, so the page stays same-origin and
|
|
106
|
-
requirement is handled server-side.
|
|
83
|
+
All upstream HTTP requests happen in the Host, so the page stays same-origin and Douban's `Referer`
|
|
84
|
+
requirement is handled server-side. Every route is admitted by the authenticated DSH browser
|
|
85
|
+
session; responses are same-origin only and carry no CORS grant.
|
|
107
86
|
|
|
108
87
|
## Configuration
|
|
109
88
|
|
|
@@ -115,21 +94,25 @@ Plugin configuration in `cordis.patch.yml`:
|
|
|
115
94
|
| `maxResults` | `12` | result cap per channel |
|
|
116
95
|
| `requestTimeoutMs` | `8000` | timeout for a single upstream request |
|
|
117
96
|
|
|
118
|
-
TMDB needs a credential: set `tmdbApiKey`, or paste a v3 key / v4 token into the
|
|
119
|
-
panel (stored only in the local browser). IMDb and
|
|
97
|
+
TMDB needs a credential: set `tmdbApiKey`, or paste a v3 key / v4 token into the settings
|
|
98
|
+
dialog in the panel (stored only in the local browser). IMDb and Douban need no key.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
The browser half stays in a single `client.js` because the DSH client loader expects one
|
|
103
|
+
classic-script registration; edit it directly, with no build step. The Host is split into
|
|
104
|
+
focused ES modules under `lib/host/` behind `lib/host.js`; upstream adapters live under
|
|
105
|
+
`lib/providers/` behind `lib/providers.js`.
|
|
106
|
+
|
|
107
|
+
| Command | Purpose |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `make check` | `node --check` on every source file |
|
|
110
|
+
| `make smoke` | the offline client/render/pick test suite |
|
|
111
|
+
| `make live` | live upstream harness against TMDB, IMDb, Douban and the BT indexes |
|
|
112
|
+
| `make publish` | publish the package to npm (prompts for a 2FA code) |
|
|
120
113
|
|
|
121
114
|
## Notes
|
|
122
115
|
|
|
123
|
-
- Requires the DSH Web GUI
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- IMDb search results carry no rating; DouBan recommendations include the public `rate`; TMDB
|
|
127
|
-
provides ratings and vote counts.
|
|
128
|
-
- IMDb related titles come from IMDb's browser GraphQL `connections` field (up to 1,250
|
|
129
|
-
relations per title); DouBan ranking chips come from `subject_collections` in the
|
|
130
|
-
subject payload.
|
|
131
|
-
- Channel browse pages return 20 items per page and stop at page 100. IMDb browse pages are
|
|
132
|
-
cursor paged through IMDb's browser GraphQL popularity index, so scrolling keeps loading new
|
|
133
|
-
titles; the home Trending row still uses a curated seed list, which is why it is limited.
|
|
134
|
-
- suggestion, rexxar, BT4G and BitSearch are undocumented endpoints and may change or rate-limit;
|
|
135
|
-
failures are surfaced per channel and do not affect the others.
|
|
116
|
+
- Requires the DSH Web GUI and network access to TMDB, IMDb, Douban, BT4G, BitSearch and the poster hosts.
|
|
117
|
+
- IMDb search results have no rating; Douban recommendations include the public `rate`; TMDB returns ratings and votes.
|
|
118
|
+
- Some upstream endpoints are undocumented and may change or rate-limit; failures are isolated per channel.
|
package/README.zh.md
CHANGED
|
@@ -9,31 +9,13 @@ DSH **影视工作台**:在一个页面里检索 **TMDB**、**IMDb** 和 **豆
|
|
|
9
9
|
|
|
10
10
|
## 功能
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
无封面的榜单自动取第一名作品的封面,点开榜单按排名展示影片,同样支持下滑加载更多。
|
|
20
|
-
- **详情页的相关卡片** — TMDB 合集、IMDb 相关系列、豆瓣收录于榜单统一放在详情页右侧栏,
|
|
21
|
-
显示为同一款紧凑卡片(封面 + 名称 + 一行说明):TMDB 合集进入合集页,IMDb 相关系列
|
|
22
|
-
按上映年份浏览全部相关作品,豆瓣的每个榜单卡片直接打开该榜单的排名影片。中间正文与简介
|
|
23
|
-
占满剩余宽度,面板较窄时右侧栏自动落到正文下方。
|
|
24
|
-
- **详情元数据** — 详情页在评分标签下以小型标签展示国家/地区、分类与片长:豆瓣来自条目
|
|
25
|
-
接口,TMDB 来自电影详情接口,IMDb 来自其浏览器 GraphQL 接口;从推荐行进入的豆瓣条目
|
|
26
|
-
(推荐数据不带年份)会用同一次详情请求补上发行年份。
|
|
27
|
-
- **BT 资源** — 查找 BT 资源,可按大小、做种、下载排序,支持下滑/「加载更多」分页;
|
|
28
|
-
可复制磁力链接或打开来源页。
|
|
29
|
-
- **AI 选资源** — 点击 BT 列表上方的「AI 选资源」会打开对话框,但只有按下「开始评估」才会
|
|
30
|
-
调用模型;评估前可先选偏好:画质(最高画质 / 均衡 / 小体积)、语言与字幕,提示词会按偏好
|
|
31
|
-
加权。对话框右上角可切换「简单模式 / 自由模式」,自由模式下简单模式选好的偏好已映射进
|
|
32
|
-
提示词,可直接查看并编辑,同时查看模型的原始输出;要求的 JSON 输出格式放在系统提示词里,
|
|
33
|
-
不可编辑。对话框底部会显示当前模型,也可以直接在那里切换(默认跟随设置里的模型)。Host
|
|
34
|
-
调用当前 DSH Profile 配置的模型(经由 DSH LLM 服务)综合做种、大小、片源质量与索引可靠性
|
|
35
|
-
挑出最佳资源;也可在设置里另选模型。被选中的行会高亮并显示「AI 推荐」徽标,列表上方展示推荐
|
|
36
|
-
理由。结果按当前条目缓存,再次打开对话框会直接展示上次结果,并支持「重新评估」。
|
|
12
|
+
- **多源搜索** — 同时检索 TMDB、IMDb 和豆瓣,结果按来源分组。
|
|
13
|
+
- **热门与渠道浏览** — 首页热门行,以及各来源的渠道页、分类标签和无限加载。
|
|
14
|
+
- **豆瓣榜单** — 电影与剧集的官方、年度和类型榜单,以及电影冷门佳作。
|
|
15
|
+
- **详情页** — 简介、元数据、相关作品与榜单收录。
|
|
16
|
+
- **BT 资源** — 搜索、排序、复制磁力链接和打开来源页。
|
|
17
|
+
- **AI 选资源** — 用 Profile 模型为 BT 资源排序,可选偏好并编辑提示词。
|
|
18
|
+
- **设置** — 在一个对话框里管理数据源、TMDB API Key 和默认模型。
|
|
37
19
|
|
|
38
20
|
## 安装
|
|
39
21
|
|
|
@@ -57,14 +39,19 @@ dsh plugin --profile desktop add dsh-movie-workbench
|
|
|
57
39
|
也支持 Git URL:`dsh plugin --profile desktop add
|
|
58
40
|
git+https://github.com/aidc-lab/dsh-movie-workbench.git`。
|
|
59
41
|
|
|
60
|
-
##
|
|
42
|
+
## 设置对话框
|
|
61
43
|
|
|
62
|
-
|
|
63
|
-
(`dsh-movie-workbench.sources`);至少保留一个渠道,只剩一个时筛选行收起到该渠道。
|
|
44
|
+
页头的齿轮按钮打开设置对话框,浏览器的本地偏好都集中在这里:
|
|
64
45
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
- **数据源** — TMDB、IMDb、豆瓣三个开关,保存在 `localStorage`
|
|
47
|
+
(`dsh-movie-workbench.sources`);至少保留一个渠道,只剩一个时筛选行收起到该渠道。
|
|
48
|
+
- **TMDB API Key** — 支持 v3 Key 或 v4 读取令牌,只保存在本机浏览器
|
|
49
|
+
(`dsh-movie-workbench.tmdb-key`);Host 端已配置 Key 时可以留空。
|
|
50
|
+
- **默认模型** — 列出 Profile 的 LLM 提供商所提供的模型(来自 Host 的 `GET /models`),
|
|
51
|
+
供「AI 选资源」使用;选择保存在 `localStorage`(`dsh-movie-workbench.ai-model`)。
|
|
52
|
+
只有配置了 DSH LLM 服务与模型时才可用。
|
|
53
|
+
|
|
54
|
+
所有修改按下「保存」后才会生效;点 ×、按 Escape 或点击对话框外部关闭会丢弃本次修改。
|
|
68
55
|
|
|
69
56
|
## Host API
|
|
70
57
|
|
|
@@ -87,9 +74,8 @@ Host 端(`index.js` + `lib/`)只有一个前缀路由 `/movie-workbench/api`
|
|
|
87
74
|
| `POST /pick` | 让 Host 端 AI 模型从最多 30 条 BT 资源中挑选最佳;请求体 `{ item, rows, lang, preferences?, prompt?, preview?, model? }`(`preferences` 为 `{ quality, language, subtitle }`,`prompt` 覆盖默认提示词,`preview: true` 只返回提示词不调用模型),返回 `pick`(`{id, rank, reason}`)、`picks`、`prompt`、`preferences` 与 `errors`(`llm_unavailable` / `llm_no_model` / `bad_preferences` / `bad_prompt` / 超时等) |
|
|
88
75
|
| `GET /image?url=` | 代理白名单图床的海报 |
|
|
89
76
|
|
|
90
|
-
所有上游 HTTP 请求都在 Host 完成,因此页面保持同源,豆瓣的 `Referer`
|
|
91
|
-
|
|
92
|
-
首页推荐行仍使用固定精选列表,因此数量有限。
|
|
77
|
+
所有上游 HTTP 请求都在 Host 完成,因此页面保持同源,豆瓣的 `Referer` 要求也由服务端
|
|
78
|
+
处理。所有路由都经过 DSH 浏览器会话的访问检查;响应仅限同源,不发送 CORS 授权。
|
|
93
79
|
|
|
94
80
|
## 配置
|
|
95
81
|
|
|
@@ -101,18 +87,24 @@ Host 端(`index.js` + `lib/`)只有一个前缀路由 `/movie-workbench/api`
|
|
|
101
87
|
| `maxResults` | `12` | 每个渠道的结果上限 |
|
|
102
88
|
| `requestTimeoutMs` | `8000` | 单个上游请求超时 |
|
|
103
89
|
|
|
104
|
-
TMDB 需要凭据:可设置 `tmdbApiKey
|
|
90
|
+
TMDB 需要凭据:可设置 `tmdbApiKey`,或在面板的「设置」对话框里粘贴 v3 Key / v4 令牌
|
|
105
91
|
(只保存在本机浏览器)。IMDb 与豆瓣无需 Key。
|
|
106
92
|
|
|
93
|
+
## 开发
|
|
94
|
+
|
|
95
|
+
浏览器端仍保持单个 `client.js`(DSH 客户端加载器只接受一次 classic-script 注册),
|
|
96
|
+
直接修改即可,没有构建步骤。Host 拆分为 `lib/host/` 下的独立 ES 模块,统一由
|
|
97
|
+
`lib/host.js` 导出;上游适配器位于 `lib/providers/`,统一由 `lib/providers.js` 导出。
|
|
98
|
+
|
|
99
|
+
| 命令 | 用途 |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `make check` | 对所有源文件执行 `node --check` |
|
|
102
|
+
| `make smoke` | 离线的 client/render/pick 测试 |
|
|
103
|
+
| `make live` | 对 TMDB、IMDb、豆瓣和 BT 索引的在线联调 |
|
|
104
|
+
| `make publish` | 发布到 npm(会提示输入 2FA 验证码) |
|
|
105
|
+
|
|
107
106
|
## 说明
|
|
108
107
|
|
|
109
|
-
- 需要 DSH Web GUI
|
|
110
|
-
`api.themoviedb.org`、`v2.sg.media-imdb.com`、`movie.douban.com`、`bt4gprx.com`、
|
|
111
|
-
`bitsearch.to` 及海报图床。
|
|
108
|
+
- 需要 DSH Web GUI,并能访问 TMDB、IMDb、豆瓣、BT4G、BitSearch 及海报图床。
|
|
112
109
|
- IMDb 搜索结果没有评分;豆瓣推荐带公开的 `rate`;TMDB 提供评分与票数。
|
|
113
|
-
-
|
|
114
|
-
豆瓣收录于榜单来自条目详情里的 `subject_collections` 字段。
|
|
115
|
-
- 渠道浏览每页 20 条、最多 100 页;IMDb 浏览页基于精选种子列表经 suggestion API 解析,
|
|
116
|
-
因此一页可能不足 20 条。
|
|
117
|
-
- suggestion、rexxar、BT4G 与 BitSearch 都是未公开接口,可能变更或限流;失败时按渠道
|
|
118
|
-
单独提示,不影响其他渠道。
|
|
110
|
+
- 部分上游接口未公开,可能变更或限流;失败按渠道隔离,不影响其他渠道。
|