bili-transcript 1.0.0 → 1.0.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.md +11 -0
  2. package/package.json +4 -3
  3. package/src/cli.mjs +14 -3
package/README.md CHANGED
@@ -23,6 +23,17 @@ npx bili-transcript <目标> # 或者直接用,不装
23
23
 
24
24
  需要 **Node 18+**(用到内置 fetch)。没有其他依赖,一条 `npm i` 装完不到 100 KB。
25
25
 
26
+ 装好后有两个等价的命令:**`bili-transcript`**(全名)和 **`bili`**(简写)。
27
+
28
+ > 全局安装报 `EACCES: permission denied, mkdir '/usr/lib/node_modules/...'`?
29
+ > 那是 npm 想往系统目录写。别用 sudo,改成装到自己的目录:
30
+ > ```sh
31
+ > npm config set prefix ~/.local
32
+ > npm install -g bili-transcript
33
+ > ```
34
+ > 再把 `~/.local/bin` 加进 PATH(fish:`fish_add_path ~/.local/bin`)。
35
+ > 或者干脆不装,用 `npx`。
36
+
26
37
  ## 快速开始
27
38
 
28
39
  ```sh
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "bili-transcript",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "提取 B 站视频的文字稿、字幕和 AI 总结。零依赖,扫码登录,纯命令行。",
5
5
  "type": "module",
6
6
  "bin": {
7
+ "bili-transcript": "src/cli.mjs",
7
8
  "bili": "src/cli.mjs"
8
9
  },
9
10
  "files": [
@@ -36,8 +37,8 @@
36
37
  "url": "https://github.com/dongliang/bili-transcript/issues"
37
38
  },
38
39
  "scripts": {
39
- "test": "sh tests/fulltest.sh",
40
- "selftest": "node src/selftest.mjs"
40
+ "test": "node tests/ci-check.mjs",
41
+ "doctor": "node src/cli.mjs doctor"
41
42
  },
42
43
  "dependencies": {},
43
44
  "optionalDependencies": {}
package/src/cli.mjs CHANGED
@@ -7,13 +7,24 @@
7
7
  // bili doctor 自检
8
8
  // bili install-skill [选项] 把 skill 装到本地 agent
9
9
  //
10
- import { writeFileSync } from 'node:fs';
10
+ import { writeFileSync, readFileSync } from 'node:fs';
11
+ import { dirname, join } from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
11
13
  import { fetchVideo, renderText } from './fetch.mjs';
12
14
  import { login } from './login.mjs';
13
15
  import { BiliError } from './api.mjs';
14
16
 
17
+ // 版本号从 package.json 读,避免写死后漂移
18
+ const VERSION = (() => {
19
+ try {
20
+ const p = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
21
+ return JSON.parse(readFileSync(p, 'utf8')).version;
22
+ } catch { return 'unknown'; }
23
+ })();
24
+
15
25
  const HELP = `
16
- bili —— B 站视频文字稿提取
26
+ bili-transcript —— B 站视频文字稿提取
27
+ (命令名 bili-transcript,简写 bili,两者等价)
17
28
 
18
29
  用法
19
30
  bili <BV号|av号|URL> [选项] 提取文字稿
@@ -87,7 +98,7 @@ async function main() {
87
98
  }
88
99
  const o = parseArgs(rest);
89
100
  if (o.help) { console.log(HELP); return; }
90
- if (o.version) { console.log(process.env.npm_package_version || '1.0.0'); return; }
101
+ if (o.version) { console.log(VERSION); return; }
91
102
 
92
103
  // ---- login ----
93
104
  if (cmd === 'login') {