dsh-hackertube 0.2.0 → 0.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.
Files changed (3) hide show
  1. package/README.en.md +146 -238
  2. package/README.md +147 -240
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -1,315 +1,223 @@
1
- # HackerTube for DeepSeek Harness
2
-
3
- [简体中文](README.md) | English
4
-
5
- Browse and watch the videos Hacker News has recommended over two decades, without leaving the DeepSeek Harness panel. A high-quality English video library within reach, which makes the harness a richer and more enjoyable place to work.
6
-
7
- ![Home](docs/home-en.png)
8
-
9
- The dataset comes from [HackerTube](https://karpathy.bearblog.dev/hacker-tube/) by Andrej Karpathy. The site ships a complete data export, and the author describes its purpose in his post:
10
-
11
- > Export of the site's data available to give to your agent to easily create your own version.
1
+ <div align="center">
12
2
 
13
- This plugin consumes that official export. It is an unofficial project and is not affiliated with Andrej Karpathy, Hacker News, or YouTube.
3
+ # HackerTube for DeepSeek Harness
14
4
 
15
- The original site works fine on its own. Moving it into the panel adds a set of things the original cannot do, listed in [How it differs from the original site](#how-it-differs-from-the-original-site).
5
+ **Two Decades of Hacker News Top Technical Videos — Right Inside Your IDE**
16
6
 
17
- ## How it differs from the original site
7
+ [![npm version](https://img.shields.io/npm/v/dsh-hackertube.svg?style=flat-square&color=cb3837)](https://www.npmjs.com/package/dsh-hackertube)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
9
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg?style=flat-square)](https://nodejs.org)
10
+ [![DeepSeek Harness](https://img.shields.io/badge/DSH-Plugin-blueviolet.svg?style=flat-square)](https://github.com/chow651/dsh-hackertube)
11
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg?style=flat-square)](package.json)
18
12
 
19
- The original is a browse-only catalog: open it, watch, close it, all in English. Inside the DSH panel it differs in seven ways.
13
+ [English](README.en.md) | [简体中文](README.md)
20
14
 
21
- **You never leave the window.** Player, details, HN discussion and related videos all live in the panel, so you can keep watching while you work.
15
+ <br />
22
16
 
23
- **The content is Chinese.** All 6454 titles and 166 category names ship with the repo and work the moment you install it. Summaries, recommendation reasons and HN comments are translated on demand, through the model first and machine translation as a fallback.
17
+ <p align="center">
18
+ No need to switch back and forth between editor tabs and a browser.<br />
19
+ Browse and watch 6,454 high-impact engineering talks, lectures, and documentaries<br />
20
+ recommended over twenty years on Hacker News, directly in your <b>DeepSeek Harness</b> workspace.<br />
21
+ Featuring full bilingual support, subtitle-aware AI answers, and a native Agent search tool.
22
+ </p>
24
23
 
25
- **You can ask the video itself.** The AI drawer hands the model the subtitle lines around your current playhead, so "what is this part about" gets an answer grounded in the content rather than a paraphrase of the description.
24
+ ![HackerTube Home Preview](docs/home-en.png)
26
25
 
27
- **There may be a Chinese-platform mirror.** Some videos have an existing repost on Bilibili, and the detail page adds a button next to YouTube when one is found. See [Alternative mirror](#alternative-mirror).
26
+ </div>
28
27
 
29
- **Likes and progress live on the host.** Likes, watch-later and history are written to the host directory, so clearing browser data does not lose them and a different browser still has them.
28
+ ---
30
29
 
31
- **Your agent can search the library.** A `hackertube_search` tool is registered, so you can ask "is there a video about Raft" without opening the panel.
30
+ ## ✨ Key Features
32
31
 
33
- **Recommendations follow your taste.** Liked videos feed the home ordering, with playlists and HN scores as a cold-start fallback.
32
+ - 📺 **Seamless In-Editor Player**: Dedicated local relay avoids third-party embed and referrer restrictions. Watch high-value engineering talks side-by-side with your code without tab-switching.
33
+ - 🤖 **Subtitle-Aware AI Q&A**: Asking "what is this part about?" extracts the exact subtitle window around your current playhead (±3 mins) for grounded, precise technical explanations.
34
+ - 🇨🇳 **Built-in Bilingual Localization**: Ships with 6,454 Chinese titles and 166 taxonomy categories ready on install. Summaries and discussions support both on-demand model translation and machine translation fallback.
35
+ - 🔍 **Native Agent Tool**: Registers `hackertube_search` so your AI agent can query 20 years of HN technical recommendations directly inside coding conversations.
36
+ - 🎯 **Smart Alternative Mirrors**: Automatically identifies quality mirrors and subtitled versions on Chinese platforms (Bilibili) using strict physical duration fingerprints. Shows a direct entry only when found; remains completely silent otherwise.
37
+ - ⚡ **Zero Runtime Dependencies & Vector Recommendations**: Pure native Node.js implementation with 384-dimensional vector centroid recommendations. Fast cold starts and host-side persistence.
34
38
 
35
- | Capability | Original site | This plugin |
36
- |---|---|---|
37
- | Browse and play | Yes | Yes |
38
- | Interface language | English | Chinese and English |
39
- | Chinese titles and categories | No | Complete, active on install |
40
- | Summary and comment translation | No | On demand, model first |
41
- | AI Q&A with subtitle context | No | Yes |
42
- | Share card | No | Yes |
43
- | Likes and watch history | Browser local | Persisted on the host |
44
- | Personalized recommendations | No | Yes |
45
- | Agent search tool | No | Yes |
46
- | Chinese-platform mirror | No | On demand, only when found |
39
+ ---
47
40
 
48
- The original's advantage is that it is plain and instant. This plugin makes browsing heavier and buys the list above with it. If you only drop in occasionally, the original site is faster.
41
+ ## 🚀 Quick Start
49
42
 
50
- ## Browse by category
43
+ > **Prerequisite**: A running installation of [DeepSeek Harness](https://github.com/chow651/dsh-hackertube).
51
44
 
52
- The 6,454 videos sort into 16 areas, and each area splits into subcategories, 150 in total. When you do not know what to watch, start from the categories page.
45
+ ### Option 1: Let Your Agent Install It (Recommended)
53
46
 
54
- ![Categories page](docs/categories-en.png)
47
+ Simply send this prompt to your agent inside DeepSeek Harness:
55
48
 
56
- | Area | Subcategories | Videos |
57
- |---|---:|---:|
58
- | Software Engineering & Languages | 11 | 980 |
59
- | Systems, Networks & Security | 10 | 702 |
60
- | AI, Machine Learning & Data | 9 | 576 |
61
- | Mathematics & Theoretical CS | 9 | 360 |
62
- | Hardware & Electronics | 8 | 582 |
63
- | Computing History & Culture | 8 | 1026 |
64
- | Design, Graphics & Visual Media | 9 | 439 |
65
- | Business, Startups & Economics | 9 | 644 |
66
- | Politics, History & Society | 9 | 1018 |
67
- | Physics, Space & Chemistry | 8 | 600 |
68
- | Life Sciences, Mind & Health | 11 | 598 |
69
- | Earth, Energy & Environment | 8 | 354 |
70
- | Engineering, Transport & Making | 12 | 805 |
71
- | Games & Game Development | 8 | 355 |
72
- | Arts, Comedy, Music & Film | 12 | 1344 |
73
- | Ideas, Learning & Language | 9 | 689 |
74
-
75
- A video can belong to more than one area, so the video counts add up to more than 6,454.
76
-
77
- ## Installation
78
-
79
- Requires DeepSeek Harness.
80
-
81
- ### Let your agent install it
82
-
83
- Paste this into a DeepSeek Harness session. The agent installs the plugin, enables it, and checks the result:
84
-
85
- ```
49
+ ```text
86
50
  Install and enable the HackerTube plugin: plugin_manager install_bundle target=dsh-hackertube.
87
51
  If npm fails, use target=github:chow651/dsh-hackertube instead.
88
52
  Then confirm dsh-hackertube is enabled in the plugin list and remind me to refresh the page.
89
53
  ```
90
54
 
91
- ### Install with the plugin manager
55
+ ### Option 2: Install via Plugin Manager
92
56
 
93
- The package is published on npm:
57
+ Run directly in the DSH terminal:
94
58
 
95
- ```
59
+ ```bash
96
60
  plugin_manager install_bundle target=dsh-hackertube
61
+ # Or directly from the GitHub repository:
62
+ # plugin_manager install_bundle target=github:chow651/dsh-hackertube
97
63
  ```
98
64
 
99
- It can also be installed straight from the Git repository, though how the host parses the install argument depends on its version:
65
+ ### Option 3: Manual Package Install
100
66
 
101
- ```
102
- plugin_manager install_bundle target=github:chow651/dsh-hackertube
103
- ```
104
-
105
- ### Install with npm or pnpm
106
-
107
- ```
67
+ ```bash
68
+ # Inside your DSH profile directory
108
69
  npm install dsh-hackertube
109
- ```
110
-
111
- ```
70
+ # or
112
71
  pnpm add dsh-hackertube
113
72
  ```
114
73
 
115
- DSH loads plugins from its profile directory, so installing into an ordinary project has no effect. Install inside that profile directory, add the package name to its `dsh.profile.bundles` array, then restart DSH. The `plugin_manager` command above does all three steps for you. Take the manual route only for scripting or bulk deployment.
116
-
117
- After installing, enable `dsh-hackertube` in the plugin list and refresh the page. No configuration, no API key, and no data to fetch beforehand.
118
-
119
- ## Features
120
-
121
- ![Watch page](docs/watch-en.png)
122
-
123
- The panel holds 6,454 videos across 16 areas and 150 categories, ordered by how strongly Hacker News recommends them. The home grid loads 60 cards at first and appends more as you scroll.
124
-
125
- The watch page has the player, the Hacker News discussion for that video, and a related rail on the right. The rail has a second pane for AI questions. It hands the model the subtitle lines within three minutes of the current playhead, so you can ask what a particular segment covers.
74
+ Enable `dsh-hackertube` in your plugin list and refresh the workspace. **No API keys or manual database initialization required.**
126
75
 
127
- A "Watch on Bilibili" button sometimes appears next to the YouTube one. It shows up only when the same video has an existing repost on the Chinese platform; when there is none, nothing appears at all.
76
+ ---
128
77
 
129
- Search works with English and Chinese queries. A Chinese query matches both the Chinese title and the English tags.
78
+ ## 🤖 Native Agent Tool Integration
130
79
 
131
- Likes, watch later, and history live on the host side, so clearing browser data does not lose them.
80
+ The plugin registers `hackertube_search` with DeepSeek Harness. Your agent can search the library semantically during development workflows:
132
81
 
133
- ### Keyboard shortcuts
82
+ ### Example Exchange
134
83
 
135
- | Key | Action |
136
- |---|---|
137
- | `/` | Focus the search field |
138
- | `j` `k` | Move between cards |
139
- | `Enter` | Open the focused card |
140
- | `l` | Like |
141
- | `w` | Add to watch later |
142
- | `h` | Back to home |
143
- | `?` | Show all shortcuts |
144
- | `Esc` | Close overlay |
84
+ > **You**: Is there any video explaining the Raft consensus algorithm? Ideally by the author.
145
85
 
146
- ## Alternative mirror
86
+ **Agent** calls `hackertube_search({ query: "Raft consensus", limit: 5 })` and replies:
147
87
 
148
- Some videos already have a repost on Bilibili, especially the subtitled ones. The watch page adds an entry next to "Watch on YouTube" when one is found, and shows nothing at all when there is none — no placeholder, no "not available" notice.
88
+ > Yes, Raft's author Diego Ongaro delivered a comprehensive lecture at Stanford: *Raft User Study Lecture* (58 min, recommended by 4 HN members). HN comments highlight that it is much more approachable than reading the paper alone. You can also watch the accompanying *Paxos Lecture* (67 min) for foundational background.
89
+ > 🔗 https://www.youtube.com/watch?v=YbZ3zDzDnrw
149
90
 
150
- The check is not keyword matching. Several hard constraints have to pass together:
91
+ ### Tool Parameters
151
92
 
152
- - **The duration must match**, within 2 seconds. A repost is a frame-accurate copy, which makes this the strongest physical fingerprint.
153
- - **It cannot predate the original.** A repost never goes up before the source.
154
- - **There has to be content evidence**: the description carries this video's source address, or the title overlaps heavily with the original, or one episode of a multi-part collection matches on duration.
93
+ | Parameter | Type | Required | Description |
94
+ |---|---|---|---|
95
+ | `query` | string | Yes | Search query in English or Chinese (e.g. `compiler optimization`, `micrograd`) |
96
+ | `limit` | number | No | Number of results to return (default `5`, max `15`) |
97
+ | `lang` | string | No | Language for returned text: `zh` (default) or `en` |
155
98
 
156
- A video address in the description is two-way evidence. Pointing at this video is proof; pointing at **another** video by the same author is a veto, even when the titles look alike. That rule came from a real miss: a video titled "Not The Confederate Flag?" had its description link to a different video, and a same-channel clip with a coincidental duration got promoted in its place.
99
+ ---
157
100
 
158
- When several reposts exist, the pick order is:
101
+ ## 💡 Comparison with the Original Site
159
102
 
160
- ```
161
- official channel → explicitly subtitled → Chinese title or high views → the rest by views
162
- ```
163
-
164
- The small tag after the button is that tier: `Official`, `Subbed`, `Translated`, or `Repost`. A repost is never dropped for low view count — some channels have no official presence at all, and a good repost is the only option.
165
-
166
- Derivative works do not count. Commentary, adaptations and reaction videos are excluded, because clicking through has to land on the same film. The exclusion is skipped when the description carries the source address, since repost channels often put words like "analysis" in the title of a genuine subtitled copy.
167
-
168
- Lookups are on demand: one query when you open the watch page, about 0.8 seconds the first time, 0 milliseconds from the local cache afterwards. Videos you never open are never queried, and no request reaches the other site for them.
169
-
170
- The hit rate is roughly half. Obscure videos and rights-heavy broadcast material simply have no repost — that is about what exists on the other side, not about how well the lookup works.
171
-
172
- ## A tool for your agent
173
-
174
- The plugin registers a tool named `hackertube_search`. Once installed, your agent can search this video library from any conversation, without opening the panel.
175
-
176
- ### One full exchange
177
-
178
- You ask:
179
-
180
- > Which video should I actually watch to understand backpropagation?
181
-
182
- The agent calls `hackertube_search({ query: "backpropagation", limit: 5, lang: "en" })`, and the tool returns (excerpt):
103
+ Built upon Andrej Karpathy's open [HackerTube data export](https://karpathy.bearblog.dev/hacker-tube/), tailored specifically for developer environments:
183
104
 
184
- ```
185
- 1. The spelled-out intro to neural networks and backpropagation: building micrograd — Andrej Karpathy · 146 min · 4.4M views · 17 recommenders
186
- HN: HN treats it as the best starting point for really understanding backprop and neural nets…
187
- https://www.youtube.com/watch?v=VMj-3S1tku0
188
-
189
- 2. Backpropagation, intuitively | Deep Learning Chapter 3 — 3Blue1Brown · 13 min · 6.4M views · 4 recommenders
190
- HN: Recommended as the most accessible introduction to backprop for people who struggle with the pure math.
191
- https://www.youtube.com/watch?v=Ilg3gGewQ5U
192
- ```
193
-
194
- The agent answers:
105
+ | Capability | Original Site | HackerTube DSH Plugin |
106
+ |---|---|---|
107
+ | **Context** | Standalone web browser | **Embedded inside DSH workspace** |
108
+ | **Localization** | English only | **Full EN/ZH bilingual**, 6,454 translated titles ready |
109
+ | **AI Q&A** | None | **Subtitle-aware temporal Q&A** |
110
+ | **Agent Tool** | None | **Native `hackertube_search` tool** |
111
+ | **Mirror Sources** | YouTube only | **Smart physical fingerprint matching for mirrors** |
112
+ | **State Persistence** | Ephemeral browser storage | **Host-side local persistence** (safe across cache clears) |
113
+ | **Recommendations** | None | **384-d vector centroid + HN co-recommendation graph** |
114
+ | **Offline Resilience** | Full network dependent | **Local caching + graceful offline degradation** |
195
115
 
196
- > Start with Karpathy's "building micrograd", 146 min. It has 17 recommenders, the strongest signal HN gives, and it builds backpropagation from scratch in code instead of explaining it on paper. If you want the intuition first, watch the 3Blue1Brown chapter (13 min) before it.
197
- > https://www.youtube.com/watch?v=VMj-3S1tku0
116
+ ---
198
117
 
199
- ### Good requests for it
118
+ ## 🖥️ Watch Page & Shortcuts
200
119
 
201
- - Any talk explaining Raft consensus
202
- - A few lectures on compiler optimization
203
- - Which Karpathy video covers backpropagation
120
+ ![Watch Page and AI Q&A](docs/watch-en.png)
204
121
 
205
- ### What it does
122
+ ### Keyboard Shortcuts
206
123
 
207
- Searches titles, channels, tags and categories in English and Chinese, plus each video's summary and Hacker News recommendation note. Results carry title, channel, duration, view count, recommender count, the recommendation note and a link, ordered by how strongly Hacker News recommends them. Chinese queries work, and titles come back in Chinese when a translation exists.
124
+ | Key | Action | Key | Action |
125
+ |---|---|---|---|
126
+ | `/` | Focus search bar | `j` / `k` | Navigate cards up/down |
127
+ | `Enter` | Open selected video | `l` | Like / Unlike |
128
+ | `w` | Add to Watch Later | `h` | Return to Home |
129
+ | `?` | Show shortcut cheatsheet | `Esc` | Close details or overlay |
208
130
 
209
- | Parameter | Meaning |
210
- |---|---|
211
- | `query` | Search terms, English or Chinese |
212
- | `limit` | Result count, default 5, max 15 |
213
- | `lang` | Language for the returned text, `zh` or `en`, default `zh` |
131
+ ### 🎯 Smart Alternative Mirrors
214
132
 
215
- ## First launch
133
+ For users facing network restrictions or seeking localized subtitles, the watch view dynamically checks for verified Chinese platform (Bilibili) mirrors:
216
134
 
217
- The plugin starts downloading the official export as soon as it loads, 17.8 MB in one request, and at the same time requests upstream pages to fill in YouTube duration, view count, and publish date. The list is only complete once both finish. A skeleton screen covers the panel in the meantime.
135
+ - **Strict Fingerprint Verification**: Compares exact duration (within ±2s tolerance), chronological release order, and bidirectional description references to rule out homonymous uploads or derivative commentary.
136
+ - **Tier Quality Ranking**: Prioritizes `Official Channel` → `Subtitled / Translated` → `High-definition Repost`.
137
+ - **Zero Noise & Silent Lookup**: Lookups are on-demand and cached locally. If no valid mirror exists, **no placeholder is rendered** — keeping the interface clean and distraction-free.
218
138
 
219
- | Scenario | Measured |
220
- |---|---|
221
- | First install, empty cache | about 10 seconds |
222
- | Later launches, list load | 45 ms |
223
- | Opening a watch page | 10 ms |
224
- | Related, the 3,778 videos with co-recommendation data | 2 ms |
225
- | Related, the other 2,676 videos, by vector similarity | about 0.7 s on first use |
226
- | Machine translation of summary and recommendation note | 0.4 to 1.8 s on first use |
139
+ <details>
140
+ <summary><b>📂 Click to expand: 16 Core Knowledge Domains (6,454 Videos)</b></summary>
227
141
 
228
- The export stays valid for seven days. YouTube metadata is cached for twenty-four hours.
142
+ <br />
229
143
 
230
- ## Chinese support
144
+ ![Categories View](docs/categories-en.png)
231
145
 
232
- Every interface string goes through `tx(lang, 中文, English)`, so neither language mode shows mixed text. Number units follow the language, with 万 and 亿 in Chinese and K and M in English.
146
+ | Area | Subcategories | Videos |
147
+ |---|---:|---:|
148
+ | Software Engineering & Languages | 11 | 980 |
149
+ | Systems, Networks & Security | 10 | 702 |
150
+ | AI, Machine Learning & Data | 9 | 576 |
151
+ | Mathematics & Theoretical CS | 9 | 360 |
152
+ | Hardware & Electronics | 8 | 582 |
153
+ | Computing History & Culture | 8 | 1026 |
154
+ | Design, Graphics & Visual Media | 9 | 439 |
155
+ | Business, Startups & Economics | 9 | 644 |
156
+ | Politics, History & Society | 9 | 1018 |
157
+ | Physics, Space & Chemistry | 8 | 600 |
158
+ | Life Sciences, Mind & Health | 11 | 598 |
159
+ | Earth, Energy & Environment | 8 | 354 |
160
+ | Engineering, Transport & Making | 12 | 805 |
161
+ | Games & Game Development | 8 | 355 |
162
+ | Arts, Comedy, Music & Film | 12 | 1344 |
163
+ | Ideas, Learning & Language | 9 | 689 |
233
164
 
234
- Content-level Chinese comes from four places.
165
+ > Note: Cross-domain videos may belong to multiple categories, so category totals exceed 6,454.
235
166
 
236
- | Content | Source | When it applies |
237
- |---|---|---|
238
- | 6,454 video titles | Translation table shipped in the repository | Immediately after install |
239
- | 166 category names | Shipped in the repository | Immediately after install |
240
- | Summary, recommendation note, quoted comment | Translated when the page opens | Model first, machine translation as fallback |
241
- | Hacker News comment bodies | Per comment or in bulk, on demand | About 1 second, then cached |
167
+ </details>
242
168
 
243
- Model output and machine translation are stored separately. Once a model is configured, its translations replace the machine output rather than being blocked by it.
169
+ ---
244
170
 
245
- Machine translation uses the public Google web translate endpoint. Comment bodies stay in English by default. Translation is an explicit action.
171
+ ## ⚡ Architecture & Performance
246
172
 
247
- ## Dependencies and degradation
173
+ - **Zero Runtime Dependencies**: Archive unpacking uses Node.js native `zlib`; no third-party npm packages required at runtime.
174
+ - **Latency Benchmarks**:
175
+ - Initial catalogue render: **~45 ms**
176
+ - Watch view open: **~10 ms**
177
+ - Co-recommendation query: **~2 ms**
178
+ - Vector cosine neighbor search: **~0.7 s** on initial run, instant in-memory afterwards
179
+ - **Graceful Degradation**:
248
180
 
249
- | Capability | Requires | Without it |
181
+ | Module | Requirements | Behavior When Missing / Offline |
250
182
  |---|---|---|
251
- | List, categories, search, playback | The DSH web server and network access | The panel or the player does not load |
252
- | Chinese titles and category names | Nothing | Shipped with the repository |
253
- | Chinese for summary and the other two fields | A model or network access | English source text is shown |
254
- | AI questions | A model configured in DSH | The panel reports the model is unavailable, everything else works |
255
- | Comment translation | Network access | The button does nothing and the text stays as written |
256
- | Subtitles and direct-stream fallback | `yt-dlp` and `ffmpeg` on PATH | Video still plays, the AI answers lose subtitle context |
257
- | Alternative mirror | The Chinese platform is reachable | No button appears, everything else works |
183
+ | **Browsing & Basic Playback** | DSH Web Container & Network | Local offline search remains available |
184
+ | **Chinese Titles & Categories** | None | Shipped with repo, 100% offline available |
185
+ | **Summaries & Comment Translation** | Model or Translation Endpoint | Automatically falls back to English source |
186
+ | **AI Q&A** | Configured DSH model | Warns model unavailable; playback unaffected |
187
+ | **Subtitle Extraction** | Optional `yt-dlp` + `ffmpeg` | AI answers lose subtitle context; playback unaffected |
188
+ | **Alternative Mirror** | Domestic platform connectivity | Hides button silently; normal playback unaffected |
258
189
 
259
- Both `yt-dlp` and `ffmpeg` are optional. They affect two things only, whether AI answers can use subtitles and whether playback can fall back to a direct stream when YouTube refuses the embed.
190
+ <details>
191
+ <summary><b>📁 Data Source & Local Cache Directory Layout</b></summary>
260
192
 
261
- ## Data source
193
+ <br />
262
194
 
263
- `https://hackertube.org/download/hackertube-data.zip`, 17.8 MB, exported on 31 October 2026.
195
+ Cached under `$DSH_PROFILE_DIR/.dsh-hackertube/` (default: `~/.dsh/.dsh-hackertube/`):
264
196
 
197
+ ```text
198
+ .dsh-hackertube/
199
+ ├── export/ # Unpacked official export (~48 MB: videos, mentions, embeddings.npy)
200
+ ├── i18n/ # Translation caches (titles, taxonomy, model output, MT cache)
201
+ ├── list.json # YouTube metadata snapshot (views, duration, dates)
202
+ ├── prefs.json # Likes, watch later list, playback progress history
203
+ ├── subs/ # On-demand subtitle files
204
+ └── mirror.json # Alternative mirror lookup cache
265
205
  ```
266
- videos.jsonl 6,454 videos with title, channel, summary, recommendation note, tags, categories, HN stats
267
- mentions.jsonl 39,834 HN comments with author, month, stance, and body
268
- related.jsonl 3,778 co-recommendation rows
269
- embeddings.npy 6,454 × 384 float16 vectors, used to fill in videos without co-recommendation data
270
- embedding_ids.json Row index to video id
271
- taxonomy.json 150 categories in 16 areas
272
- ```
273
-
274
- Unpacking uses the zlib module built into Node, so the plugin ships with no npm runtime dependencies.
275
-
276
- The export has no duration, view count, publish date, or thumbnail, since those are YouTube metadata. The list therefore still requests 65 upstream pages in parallel to fill them in, cached for one day.
277
-
278
- ## Cache
279
-
280
- Everything lives under `$DSH_PROFILE_DIR/.dsh-hackertube/`, by default `~/.dsh/.dsh-hackertube/`. Deleting the directory resets the plugin to a clean state.
281
-
282
- ```
283
- export/ Unpacked official data, about 48 MB
284
- i18n/zh-titles.json Title translations
285
- i18n/zh-taxonomy.json Category translations
286
- i18n/zh.json Model translations for detail text
287
- i18n/zh-mt.json Machine translations for detail text
288
- i18n/zh-comments.json Comment translation cache
289
- list.json YouTube metadata and list snapshot
290
- prefs.json Likes, watch later, history
291
- subs/ Subtitles
292
- mirror.json Mirror lookups and timestamps
293
- ```
294
-
295
- ## Known limitations
296
-
297
- Title translations are model output checked by rules. Most read naturally, and roughly a thousand remain close to word-for-word.
298
-
299
- A Chinese query is machine translated into English before it can reach English tags. That costs one request per query, debounced by 300 ms and cached in memory. Offline, only local matching applies.
300
206
 
301
- YouTube embeds follow upstream policy. Age-restricted and region-restricted videos are only available on YouTube.
207
+ Delete this directory at any time to reset to a pristine state.
302
208
 
303
- The playback relay listens on `127.0.0.1:18090`, falling back to 18091 and 18092 when the port is taken.
209
+ </details>
304
210
 
305
- The mirror entry appears only when a matching repost actually exists, roughly half the time. A missing button does not mean the plugin failed: most of the time the other side simply does not have that video.
211
+ ---
306
212
 
307
- ## Credits
213
+ ## 📌 Credits & Disclaimer
308
214
 
309
- Thanks to Andrej Karpathy for building HackerTube and for publishing its data export. This plugin builds on that work.
215
+ - Core data is powered by the [HackerTube](https://karpathy.bearblog.dev/hacker-tube/) project created by **[Andrej Karpathy](https://github.com/karpathy)**.
216
+ - Discussion snippets originate from [Hacker News](https://news.ycombinator.com). Video content copyright belongs to respective YouTube creators.
217
+ - This is an independent open-source plugin and is not officially affiliated with Andrej Karpathy, Hacker News, or YouTube.
310
218
 
311
- Discussion content comes from [Hacker News](https://news.ycombinator.com). Videos are hosted on YouTube.
219
+ ---
312
220
 
313
- ## License
221
+ ## 📄 License
314
222
 
315
- MIT
223
+ [MIT License](LICENSE) © 2026
package/README.md CHANGED
@@ -1,315 +1,222 @@
1
- # HackerTube for DeepSeek Harness
2
-
3
- 简体中文 | [English](README.en.md)
4
-
5
- 在 DSH 面板内浏览并播放 Hacker News 二十年间反复推荐的技术视频,无需切换到浏览器。触手可及的高质量英文视频信源,让你的 DeepSeek Harness 变得更丰富有趣。
6
-
7
- ![首页](docs/home-zh.png)
8
-
9
- 数据集来自 Andrej Karpathy 的 [HackerTube](https://karpathy.bearblog.dev/hacker-tube/)。站点提供完整的数据导出,作者在博客中说明其用途:
10
-
11
- > Export of the site's data available to give to your agent to easily create your own version.
12
-
13
- 本插件使用的正是这份官方导出。非官方项目,与 Andrej Karpathy、Hacker News、YouTube 均无隶属关系。
14
-
15
- 原站同样可以直接访问。并入面板之后它多出一些原站做不到的事情,逐条列在[与原始站点的差别](#与原始站点的差别)一节。
16
-
17
- ## 与原始站点的差别
18
-
19
- 原站是一个纯浏览型的目录:打开、看片、关掉,界面全英文。并入 DSH 面板之后,它在七件事上不一样。
20
-
21
- **不用离开当前窗口。** 播放器、详情、HN 讨论、相关推荐都在面板内,边写代码边看,不用来回切标签页。
22
-
23
- **内容是中文的。** 6454 条标题与 166 个分类名随仓库附带,装完就是中文。摘要、推荐理由、HN 评论按需翻译,优先走模型,模型不可用时退到机翻。
1
+ <div align="center">
24
2
 
25
- **可以问视频本身。** 详情页右侧的 AI 抽屉会把当前播放位置前后三分钟的字幕交给模型,所以「这一段在讲什么」得到的回答基于内容,不是复述简介。
3
+ # HackerTube for DeepSeek Harness
26
4
 
27
- **可能有中文平台的备用入口。** 有些视频在 B 站上有现成搬运,详情页会在 YouTube 按钮旁边补一个,命中才出现。详见[备用观看源](#备用观看源)。
5
+ **将 Hacker News 二十年精选的 6,454 支高分技术视频搬进你的 IDE**
28
6
 
29
- **收藏和进度存在宿主侧。** 喜欢、稍后看、播放历史写在宿主目录里,清浏览器数据不会丢,换浏览器也还在。
7
+ [![npm version](https://img.shields.io/npm/v/dsh-hackertube.svg?style=flat-square&color=cb3837)](https://www.npmjs.com/package/dsh-hackertube)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
9
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg?style=flat-square)](https://nodejs.org)
10
+ [![DeepSeek Harness](https://img.shields.io/badge/DSH-Plugin-blueviolet.svg?style=flat-square)](https://github.com/chow651/dsh-hackertube)
11
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg?style=flat-square)](package.json)
30
12
 
31
- **Agent 可以直接检索这个库。** 注册了 `hackertube_search` 工具,不用打开面板,在对话里就能问「有没有讲 Raft 的视频」。
13
+ [简体中文](README.md) | [English](README.en.md)
32
14
 
33
- **推荐会跟着你的口味走。** 喜欢过的视频参与首页排序,第一次打开时用播放列表和 HN 分数兜底。
15
+ <br />
34
16
 
35
- | 能力 | 原站 | 本插件 |
36
- |---|---|---|
37
- | 浏览与播放 | 有 | 有 |
38
- | 界面语言 | 英文 | 中英双语 |
39
- | 标题与分类中文 | 无 | 全量,装完即生效 |
40
- | 摘要与评论翻译 | 无 | 按需,模型优先 |
41
- | AI 问答(带字幕上下文) | 无 | 有 |
42
- | 分享卡片 | 无 | 有 |
43
- | 收藏与播放历史 | 浏览器本地 | 宿主侧持久化 |
44
- | 个性化推荐 | 无 | 有 |
45
- | Agent 检索工具 | 无 | 有 |
46
- | 中文平台备用源 | 无 | 按需,命中才出现 |
17
+ <p align="center">
18
+ 无需在编辑器与浏览器之间来回切换。<br />
19
+ 在 <b>DeepSeek Harness</b> 侧边栏畅享 Hacker News 社区精选的高质量技术演讲、AI 课程与系统架构视频。<br />
20
+ 开箱即用的全量中文、字幕级上下文 AI 深度解析、原生 Agent 检索工具,让高价值信源触手可及。
21
+ </p>
47
22
 
48
- 原站的优势是简洁和即开即用,本插件把浏览体验做重了,换来了上面这些。如果只是偶尔点开看看,直接访问原站更快。
23
+ ![HackerTube 首页预览](docs/home-zh.png)
49
24
 
50
- ## 分类浏览
25
+ </div>
51
26
 
52
- 6454 个视频按主题归入 16 个大类,每个大类下再细分为 150 个二级分类。不知道看什么的时候,从分类页开始逛。
27
+ ---
53
28
 
54
- ![分类页](docs/categories-zh.png)
29
+ ## ✨ 核心特性
55
30
 
56
- | 大类 | 二级分类 | 视频数 |
57
- |---|---:|---:|
58
- | 软件工程与编程语言 | 11 | 980 |
59
- | 系统、网络与安全 | 10 | 702 |
60
- | AI、机器学习与数据 | 9 | 576 |
61
- | 数学与理论计算机科学 | 9 | 360 |
62
- | 硬件与电子 | 8 | 582 |
63
- | 计算机历史与文化 | 8 | 1026 |
64
- | 设计、图形与视觉媒体 | 9 | 439 |
65
- | 商业、创业与经济 | 9 | 644 |
66
- | 政治、历史与社会 | 9 | 1018 |
67
- | 物理、太空与化学 | 8 | 600 |
68
- | 生命科学、心智与健康 | 11 | 598 |
69
- | 地球、能源与环境 | 8 | 354 |
70
- | 工程、交通与制作 | 12 | 805 |
71
- | 游戏与游戏开发 | 8 | 355 |
72
- | 艺术、喜剧、音乐与电影 | 12 | 1344 |
73
- | 思想、学习与语言 | 9 | 689 |
31
+ - 📺 **沉浸式内嵌播放**:专为 DSH 打造的独立安全中转服务,边写代码边看技术精华,无需切换窗口,告别空白屏与第三方防盗链限制。
32
+ - 🤖 **字幕级上下文 AI 问答**:问「这一段在讲什么」时,自动抓取播放点前后 3 分钟的精确字幕送入模型,直击技术细节,拒绝空洞概括。
33
+ - 🇨🇳 **开箱即用全量汉化**:随仓库内置全部 6,454 条标题与 166 个分类的中文对照,装完即用;详情摘要与 HN 讨论支持「模型精翻 + 本地机翻」双引擎按需解析。
34
+ - 🔍 **原生 Agent 检索工具**:注册 `hackertube_search` 原生 Tool,Agent 在协助日常开发时可直接检索 20 年精选视频信源并给出推荐。
35
+ - 🎯 **国内镜像无缝直达**:自动嗅探 B 站高质量搬运与中文字幕(基于物理时长指纹校验),命中即显直达入口,无则静默不打扰。
36
+ - ⚡ **零运行时依赖 & 毫秒级推荐**:纯原生 Node.js 实现(0 外部 npm 依赖),内置 384 维向量质心推荐算法;历史与喜好本地持久化。
74
37
 
75
- 一个视频可以同时属于多个大类,所以"视频数"之和大于 6454。
38
+ ---
76
39
 
77
- ## 安装
40
+ ## 🚀 快速开始
78
41
 
79
- 需要已安装 DeepSeek Harness 本体。
42
+ > **前提条件**:已安装并运行 [DeepSeek Harness](https://github.com/chow651/dsh-hackertube)。
80
43
 
81
- ### 一句话让 agent 装
44
+ ### 方式一:让 Agent 一句话自动安装(推荐)
82
45
 
83
- 把下面这段发给 DSH 里的 agent,安装、启用、核对都由它完成:
46
+ 直接在 DeepSeek Harness 对话框中把这句话发给 Agent:
84
47
 
85
- ```
48
+ ```text
86
49
  安装并启用 HackerTube 插件:plugin_manager install_bundle target=dsh-hackertube。
87
- npm 上取不到就改用 target=github:chow651/dsh-hackertube。
88
- 装完确认插件列表里 dsh-hackertube 已启用,并提醒我刷新页面。
50
+ 若 npm 访问受限则使用 target=github:chow651/dsh-hackertube。
51
+ 装完确认插件列表中 dsh-hackertube 已启用,并提醒我刷新页面。
89
52
  ```
90
53
 
91
- ### 用插件管理器安装
54
+ ### 方式二:使用插件管理器安装
92
55
 
93
- 包已发布到 npm:
56
+ 在 DSH 终端执行:
94
57
 
95
- ```
58
+ ```bash
96
59
  plugin_manager install_bundle target=dsh-hackertube
60
+ # 或直接从 GitHub 仓库安装:
61
+ # plugin_manager install_bundle target=github:chow651/dsh-hackertube
97
62
  ```
98
63
 
99
- 也可以直接从 Git 仓库安装,宿主如何解析安装参数取决于版本:
64
+ ### 方式三:手动包管理安装
100
65
 
101
- ```
102
- plugin_manager install_bundle target=github:chow651/dsh-hackertube
103
- ```
104
-
105
- ### 用 npm 或 pnpm 安装
106
-
107
- ```
66
+ ```bash
67
+ # 在 DSH profile 目录下执行
108
68
  npm install dsh-hackertube
109
- ```
110
-
111
- ```
69
+ # 或
112
70
  pnpm add dsh-hackertube
113
71
  ```
114
72
 
115
- DSH 从 profile 目录加载插件,在普通项目里安装不会生效。需要在该 profile 目录下安装,把包名加入它的 `dsh.profile.bundles` 数组,然后重启 DSH。上面那条 `plugin_manager` 命令会自动完成这三步,只有在写脚本或做批量部署时才需要手动走一遍。
116
-
117
- 安装后在插件列表中启用 `dsh-hackertube` 并刷新页面。无需额外配置,无需 API key,也不需要在安装前预取任何数据。
118
-
119
- ## 功能
120
-
121
- ![详情页](docs/watch-zh.png)
122
-
123
- 收录 6454 个视频,分属 16 个大类与 150 个二级分类,按 HN 推荐力度排序。首页首次加载 60 条,滚动时分批追加。
124
-
125
- 详情页包含播放器、该视频在 HN 上的讨论,以及右侧的相关推荐。右侧另有 AI 问答页,会把当前播放位置前后三分钟的字幕片段一并交给模型,因此可以询问某一段的具体内容。
73
+ 安装完成后在插件列表中启用 `dsh-hackertube` 并刷新页面即可。**无需任何 API Key,无需预配置,开箱即用。**
126
74
 
127
- 播放按钮旁边有时会多出一个「在 B 站观看」,那是查到同一支片子有中文平台搬运时才会出现的备用入口,没有就是没有。
75
+ ---
128
76
 
129
- 搜索支持中英文混用,中文查询会同时匹配中文标题与英文标签。
77
+ ## 🤖 原生 Agent 工具集成
130
78
 
131
- 喜欢、稍后看与播放历史记录在宿主侧,清除浏览器数据不会丢失。
79
+ 插件向 DeepSeek Harness 注册了 `hackertube_search` 原生工具。在日常写代码或向 Agent 提问时,Agent 可直接按语义检索视频库并给出带技术依据的参考:
132
80
 
133
- ### 快捷键
81
+ ### 对话示例
134
82
 
135
- | 按键 | 作用 |
136
- |---|---|
137
- | `/` | 聚焦搜索框 |
138
- | `j` `k` | 在卡片间上下移动 |
139
- | `Enter` | 打开当前卡片 |
140
- | `l` | 标记喜欢 |
141
- | `w` | 加入稍后看 |
142
- | `h` | 返回首页 |
143
- | `?` | 显示快捷键一览 |
144
- | `Esc` | 关闭浮层 |
83
+ > **你**:有没有讲 Raft 共识算法的视频?最好是作者本人讲的。
145
84
 
146
- ## 备用观看源
85
+ **Agent** 自动调用 `hackertube_search({ query: "Raft 共识算法", limit: 5 })`,秒级分析后回答:
147
86
 
148
- 有些视频在 B 站上有现成的搬运,尤其是带字幕的那种。详情页会在「在 YouTube 观看」旁边补一个入口,命中才出现,没命中就什么都不显示——不放占位、不显示「暂无」。
87
+ > 有,推荐看 Raft 作者 Diego Ongaro 本人在 Stanford 的公开演讲《Raft 讲座》(58 分钟,HN 4 人力荐)。社区评价它比论文更加通俗直观;若需了解前置知识,可以搭配同系列的《Paxos 讲座》(67 分钟)一起看。
88
+ > 🔗 https://www.youtube.com/watch?v=YbZ3zDzDnrw
149
89
 
150
- 判定不是关键词匹配,是几条硬约束一起过:
90
+ ### 工具参数
151
91
 
152
- - **时长必须一致**,容差 ±2 秒。搬运是逐秒复制的,这是最稳的物理指纹。
153
- - **不能早于原视频发布**。搬运不会早于原片。
154
- - **要有内容凭据**:简介里写着本条原视频的地址,或者标题与原标题高度重合,或者合集里某一集的时长对得上。
92
+ | 参数 | 类型 | 必填 | 说明 |
93
+ |---|---|---|---|
94
+ | `query` | string | 是 | 检索关键词,支持中英文混搜(如 `编译器优化`、`micrograd`) |
95
+ | `limit` | number | 否 | 返回条数,默认 `5`,最多 `15` |
96
+ | `lang` | string | 否 | 返回文本语言,`zh`(默认)或 `en` |
155
97
 
156
- 简介里的视频地址是双向证据。它指向本条,就是铁证;它指向同一个作者的**另一支**视频,就直接否决,哪怕标题很像。这条规则来自一次真实的误判:某频道《这不是邦联国旗?》的简介里写着另一支视频的地址,被同频道一条时长巧合的片子顶了上来。
98
+ ---
157
99
 
158
- 多个搬运版本时按这个顺序挑:
100
+ ## 💡 与原始 HackerTube 站点的对比
159
101
 
160
- ```
161
- 官方入驻号 → 明确标注中字或熟肉 → 中文标题或高播放 → 其余按播放量
162
- ```
163
-
164
- 按钮后面的小标就是档位,`官方`、`中字`、`中文`、`转载` 四种。转载不会因为播放量低被丢掉——有的频道根本没有官方入驻,高质量转载就是唯一选项。
165
-
166
- 二次创作不算。解说、改编、reaction 这类重新演绎的内容会被排除,点过去看到的必须是同一支片子。但简介里有原视频地址时不排除,因为搬运号常把「万字解析」这类词当自家噱头,标在真熟肉标题上。
167
-
168
- 查询是按需的:打开详情页才查一次,首次约 0.8 秒,之后读本地缓存是 0 毫秒。没打开过的视频不会被查,也不会向对方站点发出任何请求。
169
-
170
- 命中率大约一半。冷门视频、版权严格的官媒内容基本找不到对应搬运,这是内容存量决定的——不是查询能力不够,是对面真的没有。
171
-
172
- ## 给 agent 用的工具
173
-
174
- 插件注册了一个工具 `hackertube_search`。装了插件之后,不用打开面板,agent 在对话里就能检索这个视频库。
175
-
176
- ### 一次完整的对话
177
-
178
- 你问:
179
-
180
- > 有没有讲 Raft 共识算法的视频?最好是作者本人讲的。
181
-
182
- agent 调用 `hackertube_search({ query: "Raft 共识算法", limit: 5 })`,工具返回(节选):
102
+ 本项目基于 Andrej Karpathy 开源的 [HackerTube 官方导出数据](https://karpathy.bearblog.dev/hacker-tube/),针对 IDE 开发者工作流进行了全面重构:
183
103
 
184
- ```
185
- 1. Paxos 讲座(Raft 用户研究) — Diego Ongaro · 67 分钟 · 11.4 万次观看 · 6 人推荐
186
- HN:Recommended as a clear, lucid way to learn Paxos and Multi-Paxos…
187
- https://www.youtube.com/watch?v=JEpsBg0AO6o
188
-
189
- 2. Raft 讲座(Raft 用户研究) — Diego Ongaro · 58 分钟 · 8.7 万次观看 · 4 人推荐
190
- HN:HN commenters recommend it as a clearer introduction to Raft than the paper…
191
- https://www.youtube.com/watch?v=YbZ3zDzDnrw
192
- ```
193
-
194
- agent 据此回答:
104
+ | 能力维度 | 原始站点 | 本插件 (DSH Plugin) |
105
+ |---|---|---|
106
+ | **交互场景** | 独立网页浏览 | **嵌入 DSH 工作台**,边写代码边看 |
107
+ | **语言支持** | 纯英文 | **全量中英双语**,6,454 条中文标题装完即用 |
108
+ | **AI 问答** | 无 | **带播放点字幕上下文**的深度问答 |
109
+ | **Agent 调用** | 无 | **内置 Agent 原生检索工具** |
110
+ | **观看备用源** | 仅 YouTube | **智能嗅探国内高质量搬运/中字** |
111
+ | **进度与偏好** | 浏览器本地临时存储 | **宿主本地持久化**,清理浏览器缓存不丢失 |
112
+ | **个性化推荐** | 无 | **384 维向量质心 + HN 共推荐图谱** |
113
+ | **离线友好度** | 依赖全量实时请求 | **本地高速缓存 + 优雅降级策略** |
195
114
 
196
- > 有,而且就是 Raft 作者 Diego Ongaro 本人讲的。先看第二个《Raft 讲座》,58 分钟,HN 上的评论说它比读论文好懂;它和第一个《Paxos 讲座》是同一套课程,通常一起看。
197
- > https://www.youtube.com/watch?v=YbZ3zDzDnrw
115
+ ---
198
116
 
199
- ### 适合这类请求
117
+ ## 🖥️ 界面与交互
200
118
 
201
- - 有没有讲 Raft 共识算法的视频
202
- - 找几个讲编译器优化的演讲
203
- - Karpathy 讲反向传播的是哪一个
119
+ ![详情页与 AI 问答](docs/watch-zh.png)
204
120
 
205
- ### 它做什么
121
+ ### 快捷键支持
206
122
 
207
- 按中英文检索标题、频道、标签、分类,以及每个视频的简介和 HN 推荐理由,返回标题、频道、时长、观看量、HN 推荐人数、推荐理由与链接,并按 HN 推荐强度排序。中文查询也能命中,结果里的标题会显示中文译文。
123
+ | 按键 | 作用 | 按键 | 作用 |
124
+ |---|---|---|---|
125
+ | `/` | 聚焦搜索框 | `j` / `k` | 上下移动选中卡片 |
126
+ | `Enter` | 打开选中视频 | `l` | 喜欢 / 取消喜欢 |
127
+ | `w` | 加入稍后看 | `h` | 返回首页 |
128
+ | `?` | 显示快捷键指南 | `Esc` | 关闭详情或浮层 |
208
129
 
209
- | 参数 | 说明 |
210
- |---|---|
211
- | `query` | 检索词,中英文均可 |
212
- | `limit` | 返回条数,默认 5,最多 15 |
213
- | `lang` | 返回文案的语言,`zh` 或 `en`,默认 `zh` |
130
+ ### 🎯 国内备用源智能直达
214
131
 
215
- ## 首次启动
132
+ 为方便网络受限或偏好中文字幕的开发者,插件在详情页提供智能国内平台(B站)备用入口:
216
133
 
217
- 插件加载时即开始下载官方数据导出(17.8 MB,一次性),并同时请求上游接口补齐 YouTube 的时长、播放量与发布时间。两者完成后列表才是完整状态,期间界面显示骨架屏。
134
+ - **严格指纹校验**:基于物理视频时长(±2s 容差)、发布时序及双向引用凭据进行刚性校验,杜绝同名搬运与二创误判。
135
+ - **版本质量优选**:自动在多个搬运中优先挑选 `官方` → `中字/熟肉` → `高清` 版本。
136
+ - **静默按需查询**:仅在打开详情页时按需毫秒级检索并缓存;若未检索到对应搬运则**完全静默不打扰**,不增加额外占位。
218
137
 
219
- | 项目 | 实测耗时 |
220
- |---|---|
221
- | 首次安装(空缓存) | 约 10 秒 |
222
- | 后续启动,列表加载 | 45 毫秒 |
223
- | 打开详情页 | 10 毫秒 |
224
- | 相关推荐,有共推荐关系的 3778 个视频 | 2 毫秒 |
225
- | 相关推荐,其余 2676 个视频(向量近邻) | 首次约 0.7 秒 |
226
- | 摘要与推荐理由机翻 | 首次 0.4 至 1.8 秒 |
138
+ <details>
139
+ <summary><b>📂 点击展开:16 个技术领域分类分布(6,454 支视频)</b></summary>
227
140
 
228
- 数据导出有效期为七天,YouTube 元信息缓存二十四小时。
141
+ <br />
229
142
 
230
- ## 中文支持
143
+ ![分类浏览页](docs/categories-zh.png)
231
144
 
232
- 界面文案统一通过 `tx(lang, 中文, English)` 输出,两种语言下均不会出现中英混排。数量单位随语言切换,中文使用万与亿,英文使用 K 与 M。
145
+ | 大类 | 子分类数 | 包含视频数 |
146
+ |---|---:|---:|
147
+ | 软件工程与编程语言 | 11 | 980 |
148
+ | 系统、网络与安全 | 10 | 702 |
149
+ | AI、机器学习与数据 | 9 | 576 |
150
+ | 数学与理论计算机科学 | 9 | 360 |
151
+ | 硬件与电子 | 8 | 582 |
152
+ | 计算机历史与文化 | 8 | 1026 |
153
+ | 设计、图形与视觉媒体 | 9 | 439 |
154
+ | 商业、创业与经济 | 9 | 644 |
155
+ | 政治、历史与社会 | 9 | 1018 |
156
+ | 物理、太空与化学 | 8 | 600 |
157
+ | 生命科学、心智与健康 | 11 | 598 |
158
+ | 地球、能源与环境 | 8 | 354 |
159
+ | 工程、交通与制作 | 12 | 805 |
160
+ | 游戏与游戏开发 | 8 | 355 |
161
+ | 艺术、喜剧、音乐与电影 | 12 | 1344 |
162
+ | 思想、学习与语言 | 9 | 689 |
233
163
 
234
- 内容层面的中文来源如下。
164
+ > 注:部分跨领域视频可能归属于多个分类,因此各分类视频数之和大于总数。
235
165
 
236
- | 内容 | 来源 | 生效时机 |
237
- |---|---|---|
238
- | 6454 条视频标题 | 随仓库附带的译文表 | 安装后立即生效 |
239
- | 166 条分类名称 | 随仓库附带 | 安装后立即生效 |
240
- | 摘要、推荐理由、评论引用 | 打开时自动翻译 | 优先使用模型,模型不可用时使用机翻 |
241
- | HN 评论正文 | 逐条翻译或整段翻译 | 首次约 1 秒,之后读取缓存 |
166
+ </details>
242
167
 
243
- 模型译文与机翻译文分别存放。配置模型后,模型译文会覆盖机翻结果,不会因机翻先行而无法更新。
168
+ ---
244
169
 
245
- 机翻调用 Google 网页翻译的公共端点。评论正文默认保持英文原文,翻译为显式操作。
170
+ ## ⚡ 性能与技术架构
246
171
 
247
- ## 依赖与降级
172
+ - **零运行时依赖**:解压采用 Node.js 原生 `zlib`,无任何额外 npm 运行时依赖,极轻极简。
173
+ - **极致响应速度**:
174
+ - 启动后列表渲染:**~45 ms**
175
+ - 详情页打开耗时:**~10 ms**
176
+ - 关联推荐(共推荐关系):**~2 ms**
177
+ - 向量余弦近邻检索:首次约 **0.7 s**,后续全内存命中
178
+ - **优雅降级机制**:
248
179
 
249
- | 能力 | 依赖 | 缺失时的表现 |
180
+ | 功能模块 | 运行条件 | 离线 / 依赖缺失时的降级表现 |
250
181
  |---|---|---|
251
- | 列表、分类、搜索、播放 | DSH 的 webServer 与外网 | 面板不可用或播放器无法加载 |
252
- | 中文标题与分类名 | 无 | 已随仓库提供 |
253
- | 摘要等三段文本的中文 | 模型或外网 | 显示英文原文 |
254
- | AI 问答 | DSH 已配置模型 | 面板提示模型不可用,其余功能正常 |
255
- | 评论翻译 | 外网 | 按钮无响应,文本保持原文 |
256
- | 字幕与直链兜底播放 | PATH 中存在 yt-dlp 与 ffmpeg | 视频仍可播放,AI 缺少字幕上下文 |
257
- | 备用观看源 | 中文平台可达 | 不出现按钮,其余功能正常 |
182
+ | **浏览、检索与基础播放** | DSH Web 容器与网络 | 本地离线索引可用,支持本地搜索 |
183
+ | **中文标题与全部分类** | 无任何外部依赖 | 随仓库自带,100% 永久离线生效 |
184
+ | **摘要与长评论翻译** | 模型或网络翻译通道 | 自动回退展示英文原文 |
185
+ | **AI 问答** | DSH 已配置模型 | 提示模型未就绪,基础播放与浏览不受影响 |
186
+ | **字幕提取** | 可选本地 `yt-dlp` + `ffmpeg` | 缺失时仅影响 AI 获取实时字幕,视频照常播放 |
187
+ | **国内备用源** | 国内平台网络连通 | 无法连通时不展示备用入口,正常走原版播放 |
258
188
 
259
- yt-dlp 与 ffmpeg 均为可选。它们只影响两件事:AI 问答能否携带字幕上下文,以及 YouTube 嵌入被拒绝时能否回退到直链播放。
189
+ <details>
190
+ <summary><b>📁 数据源与本地缓存存储结构</b></summary>
260
191
 
261
- ## 数据来源
192
+ <br />
262
193
 
263
- `https://hackertube.org/download/hackertube-data.zip`,17.8 MB,导出于 2026 年 10 月 31 日。
194
+ 数据首次加载后缓存在 `$DSH_PROFILE_DIR/.dsh-hackertube/`(默认路径为 `~/.dsh/.dsh-hackertube/`):
264
195
 
196
+ ```text
197
+ .dsh-hackertube/
198
+ ├── export/ # 官方解压数据包(~48 MB,含 videos、mentions、embeddings.npy 等)
199
+ ├── i18n/ # 中文译文缓存(标题、分类、模型精翻、机翻持久化)
200
+ ├── list.json # YouTube 播放量、时长与发布时间元数据快照
201
+ ├── prefs.json # 用户的喜欢、稍后看与播放进度历史
202
+ ├── subs/ # 按需缓存的字幕文件
203
+ └── mirror.json # 备用源检索结果与时效缓存
265
204
  ```
266
- videos.jsonl 6454 条视频,含标题、频道、摘要、推荐理由、标签、分类、HN 统计
267
- mentions.jsonl 39834 条 HN 评论,含作者、月份、立场、原文
268
- related.jsonl 3778 条共推荐关系
269
- embeddings.npy 6454 × 384 维 float16 向量,用于补齐无共推荐关系的视频
270
- embedding_ids.json 向量行号与视频 id 的对应
271
- taxonomy.json 150 个分类,16 个大类
272
- ```
273
-
274
- 解压使用 Node 内置的 zlib,插件不引入任何 npm 运行时依赖。
275
-
276
- 导出不包含时长、播放量、发布时间与封面,这些字段属于 YouTube 元数据,因此列表仍会并行请求 65 页上游接口补齐,结果缓存一天。
277
-
278
- ## 缓存目录
279
-
280
- 全部位于 `$DSH_PROFILE_DIR/.dsh-hackertube/`,默认路径为 `~/.dsh/.dsh-hackertube/`。删除整个目录可恢复到初始状态。
281
-
282
- ```
283
- export/ 解包后的官方数据,约 48 MB
284
- i18n/zh-titles.json 标题译文
285
- i18n/zh-taxonomy.json 分类译文
286
- i18n/zh.json 模型翻译的详情文本
287
- i18n/zh-mt.json 机翻的详情文本
288
- i18n/zh-comments.json 评论机翻缓存
289
- list.json YouTube 元信息与列表快照
290
- prefs.json 喜欢、稍后看、历史
291
- subs/ 字幕
292
- mirror.json 备用源解析结果与时间戳
293
- ```
294
-
295
- ## 已知限制
296
-
297
- 标题译文由模型生成后按规则校对,多数通顺,仍有约一千条偏向直译。
298
-
299
- 中文查询需要先机翻为英文才能命中英文标签,每次查询发起一次请求,含 300 毫秒防抖与内存缓存。断网时仅保留本地匹配。
300
205
 
301
- YouTube 嵌入受上游策略限制,年龄限制或地区限制的视频需前往 YouTube 观看。
206
+ 如需重置初始状态,只需清空该目录即可。
302
207
 
303
- 播放中转页监听 `127.0.0.1:18090`,端口被占用时依次尝试 18091 与 18092。
208
+ </details>
304
209
 
305
- 备用源只在确实存在对应搬运时出现,覆盖率约一半。没出现按钮不代表插件没工作,多数情况是对面确实没有这支片子。
210
+ ---
306
211
 
307
- ## 致谢
212
+ ## 📌 致谢与声明
308
213
 
309
- 感谢 Andrej Karpathy 开发 HackerTube 并将数据导出公开,本插件建立在这份工作之上。
214
+ - 核心数据源自 **[Andrej Karpathy](https://github.com/karpathy)** 创建的 [HackerTube](https://karpathy.bearblog.dev/hacker-tube/) 项目并遵循其开放数据倡议。
215
+ - 讨论内容取自 [Hacker News](https://news.ycombinator.com),视频版权归 YouTube 原创作者所有。
216
+ - 本项目为开源社区第三方插件,非官方出品,与 Andrej Karpathy、Hacker News 或 YouTube 无隶属关系。
310
217
 
311
- 讨论内容来自 [Hacker News](https://news.ycombinator.com),视频托管于 YouTube。
218
+ ---
312
219
 
313
- ## 许可
220
+ ## 📄 许可证
314
221
 
315
- MIT
222
+ [MIT License](LICENSE) © 2026
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-hackertube",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "DeepSeek Harness 插件:在面板里看 Hacker News 二十年推荐的 6454 个技术视频",
5
5
  "type": "module",
6
6
  "license": "MIT",