Sanitize for open-source release
- Replace internal tenant name yitanger.feishu.cn with your-tenant.feishu.cn - Replace real wiki token with placeholder WikiNodeTokenExample - Parameterize tenant via FEISHU_TENANT env var in feishu-to-md.mjs - Expand .gitignore to cover cookies, auth artifacts, IDE files
This commit is contained in:
+20
@@ -1,2 +1,22 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
|
||||
# Output
|
||||
output
|
||||
|
||||
# Cookies / sessions (auto-generated by scraper)
|
||||
cookies.json
|
||||
feishu-cookies.json
|
||||
feishu-wiki-cookies.json
|
||||
*-cookies.json
|
||||
|
||||
# Auth artifacts
|
||||
feishu-auth-qr.png
|
||||
|
||||
# Local config / IDE
|
||||
.claude/
|
||||
.debug/
|
||||
.DS_Store
|
||||
|
||||
# Bundled browsers (pkg build output)
|
||||
browsers/
|
||||
|
||||
@@ -52,7 +52,7 @@ node feishu-to-md.mjs <wiki_url>
|
||||
**示例:**
|
||||
|
||||
```bash
|
||||
node feishu-to-md.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
```
|
||||
|
||||
**输出:**
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* 示例:
|
||||
* node auto-scrape.mjs https://yitang.top/fs-doc/abc123/docId
|
||||
* node auto-scrape.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9i...
|
||||
* node auto-scrape.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample...
|
||||
*
|
||||
* Cookie 持久化:首次登录后自动保存,之后无需重复扫码。
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ if (!args[0] || args[0] === '--help' || args[0] === '-h') {
|
||||
|
||||
示例:
|
||||
node auto-scrape.mjs https://yitang.top/fs-doc/abc/docId
|
||||
node auto-scrape.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node auto-scrape.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
node auto-scrape.mjs https://yitang.top/fs-doc/abc/docId 课程笔记.md
|
||||
`);
|
||||
process.exit(0);
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ if (!argv[0] || argv[0] === '--help' || argv[0] === '-h') {
|
||||
目标文件夹token 可选,新文档放在指定文件夹下
|
||||
|
||||
示例:
|
||||
node feishu-copy.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-copy.mjs https://yitanger.feishu.cn/wiki/ABC123 fldcnXXXXXXX
|
||||
node feishu-copy.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
node feishu-copy.mjs https://your-tenant.feishu.cn/wiki/ABC123 fldcnXXXXXXX
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
+14
-3
@@ -20,15 +20,26 @@ if (!argv[0] || argv[0] === '--help' || argv[0] === '-h') {
|
||||
用法:node feishu-to-md.mjs <wiki_url_or_token> [输出目录]
|
||||
|
||||
示例:
|
||||
node feishu-to-md.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-to-md.mjs R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
FEISHU_TENANT=your-tenant node feishu-to-md.mjs WikiNodeTokenExample
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const input = argv[0].trim();
|
||||
const outDir = argv[1] ? resolve(argv[1]) : resolve('./output');
|
||||
const wikiUrl = input.startsWith('http') ? input : `https://yitanger.feishu.cn/wiki/${input}`;
|
||||
let wikiUrl;
|
||||
if (input.startsWith('http')) {
|
||||
wikiUrl = input;
|
||||
} else {
|
||||
const tenant = process.env.FEISHU_TENANT;
|
||||
if (!tenant) {
|
||||
console.error('❌ 传入纯 token 时需设置 FEISHU_TENANT 环境变量,例如:');
|
||||
console.error(' FEISHU_TENANT=your-tenant node feishu-to-md.mjs <token>');
|
||||
process.exit(1);
|
||||
}
|
||||
wikiUrl = `https://${tenant}.feishu.cn/wiki/${input}`;
|
||||
}
|
||||
|
||||
// lark-cli 命令必须在 outDir 下执行(+media-preview 只接受相对路径)
|
||||
process.chdir(outDir);
|
||||
|
||||
Reference in New Issue
Block a user