Skip to content

Commit 9e76f70

Browse files
committed
feat(download): show saved file path in web read and weixin download output
Closes #1038
1 parent 44147e5 commit 9e76f70

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

clis/web/read.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cli({
2727
{ name: 'download-images', type: 'boolean', default: true, help: 'Download images locally' },
2828
{ name: 'wait', type: 'int', default: 3, help: 'Seconds to wait after page load' },
2929
],
30-
columns: ['title', 'author', 'publish_time', 'status', 'size'],
30+
columns: ['title', 'author', 'publish_time', 'status', 'size', 'saved'],
3131
func: async (page, kwargs) => {
3232
const url = kwargs.url;
3333
const waitSeconds = kwargs.wait ?? 3;

clis/weixin/download.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ cli({
179179
{ name: 'output', default: './weixin-articles', help: 'Output directory' },
180180
{ name: 'download-images', type: 'boolean', default: true, help: 'Download images locally' },
181181
],
182-
columns: ['title', 'author', 'publish_time', 'status', 'size'],
182+
columns: ['title', 'author', 'publish_time', 'status', 'size', 'saved'],
183183
func: async (page, kwargs) => {
184184
const rawUrl = kwargs.url;
185185
const url = normalizeWechatUrl(rawUrl);
186186
if (!url.startsWith('https://mp.weixin.qq.com/')) {
187-
return [{ title: 'Error', author: '-', publish_time: '-', status: 'invalid URL', size: '-' }];
187+
return [{ title: 'Error', author: '-', publish_time: '-', status: 'invalid URL', size: '-', saved: '-' }];
188188
}
189189
// Navigate and wait for content to load
190190
await page.goto(url);
@@ -297,6 +297,7 @@ cli({
297297
publish_time: '-',
298298
status: 'failed — verification required in WeChat browser page',
299299
size: '-',
300+
saved: '-',
300301
}];
301302
}
302303
return downloadArticle({

skills/opencli-usage/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Public API commands (`hackernews`, `v2ex`) need no browser.
4747
| **post/create** | Twitter, Jike, Douyin, Weibo |
4848
| **AI chat** | Grok, Doubao, ChatGPT, Gemini, Cursor, Codex, NotebookLM |
4949
| **finance/stock** | Xueqiu, Yahoo Finance, Barchart, Sina Finance, Bloomberg |
50-
| **web scraping** | `opencli web read --url <url>` — any URL to Markdown |
50+
| **web scraping** | `opencli web read --url <url>` — any URL to Markdown (saves to local file, check `saved` field in output) |
5151
| **GitHub/DevOps** | `opencli gh`, `opencli docker`, `opencli vercel` — external CLI passthrough |
5252
| **collaboration** | `opencli lark-cli`, `opencli dws`, `opencli wecom-cli` — external CLI passthrough |
5353

@@ -118,9 +118,9 @@ Type legend: 🌐 = Browser (needs Chrome login) · ✅ = Public API (no browser
118118
| **tiktok** | 🌐 | `explore` `search` `profile` `user` `following` `follow` `unfollow` `like` `unlike` `comment` `save` `unsave` `live` `notifications` `friends` |
119119
| **twitter** | 🌐 | `trending` `bookmarks` `search` `profile` `timeline` `thread` `article` `follow` `unfollow` `bookmark` `unbookmark` `post` `like` `likes` `reply` `delete` `block` `unblock` `followers` `following` `notifications` `hide-reply` `download` `accept` `reply-dm` |
120120
| **v2ex** | ✅🌐 | Public: `hot` `latest` `topic` `node` `nodes` `member` `user` `replies` · Browser: `daily` `me` `notifications` |
121-
| **web** | 🌐 | `read` — any URL to Markdown |
121+
| **web** | 🌐 | `read` — any URL to Markdown (saves to local file, not stdout) |
122122
| **weibo** | 🌐 | `hot` `search` `feed` `user` `me` `post` `comments` |
123-
| **weixin** | 🌐 | `download` — 公众号 article to Markdown |
123+
| **weixin** | 🌐 | `download` — 公众号 article to Markdown (saves to local file, not stdout) |
124124
| **weread** | 🌐 | `shelf` `search` `book` `highlights` `notes` `notebooks` `ranking` |
125125
| **wikipedia** || `search` `summary` `random` `trending` |
126126
| **xianyu** | 🌐 | `search` `item` `chat` |

skills/opencli-usage/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ opencli v2ex notifications --limit 10 # 通知
671671
## Web 🌐
672672

673673
```bash
674-
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown
674+
opencli web read --url "https://..." # 抓取任意网页并导出为 Markdown(默认保存到 ./web-articles/,可用 --output 修改)
675675
```
676676

677677
## Weibo (微博) 🌐
@@ -689,7 +689,7 @@ opencli weibo comments <mid> # 微博评论
689689
## Weixin (微信公众号) 🌐
690690

691691
```bash
692-
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown
692+
opencli weixin download --url "https://mp.weixin.qq.com/s/xxx" # 下载公众号文章为 Markdown(默认保存到 ./weixin-articles/,可用 --output 修改)
693693
```
694694

695695
## WeRead (微信读书) 🌐

src/download/article-download.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface ArticleDownloadResult {
5656
publish_time: string;
5757
status: string;
5858
size: string;
59+
saved: string;
5960
}
6061

6162
const DEFAULT_LABELS: Required<FrontmatterLabels> = {
@@ -212,6 +213,7 @@ export async function downloadArticle(
212213
publish_time: '-',
213214
status: 'failed — no title',
214215
size: '-',
216+
saved: '-',
215217
}];
216218
}
217219

@@ -222,6 +224,7 @@ export async function downloadArticle(
222224
publish_time: data.publishTime || '-',
223225
status: 'failed — no content',
224226
size: '-',
227+
saved: '-',
225228
}];
226229
}
227230

@@ -268,5 +271,6 @@ export async function downloadArticle(
268271
publish_time: data.publishTime || '-',
269272
status: 'success',
270273
size: formatBytes(size),
274+
saved: filePath,
271275
}];
272276
}

0 commit comments

Comments
 (0)