docs: README update

This commit is contained in:
fengxxc
2023-01-01 20:48:07 +08:00
parent b9b8a92945
commit 93bd4cbbfb

View File

@@ -3,29 +3,42 @@
## 使用
### CLI 模式
通过命令行使用
执行命令:`本程序可执行文件 [url] [filename]`
- `url` 微信公众号文章网页的url
- `filename` makedown文件的保存路径和文件名
执行命令:`本程序可执行文件 [url] [filepath] [--image]`
- `url` 微信公众号文章网页的url
- `filepath` makedown文件的保存位置,若该值为目录,则以文章标题作为文件名保存在该目录下;若以`.md`结尾,则以输入的文件名作为文件名保存;`./`为保存到当前目录
- `--image` 可选参数,文章内图片的保存方式,格式为`--image=xxx``xxx`为参数值有三个可供选择默认值为base64
- `url` 图片引用原src值它通常在网络上不推荐微信哪天把它ban掉就寄了
- `save` 图片存在本地在与markdown同一个目录中若为web server模式则一并打包成zip下载
- `base64` 图片编码成base64字符串放在markdown文件内
例如windows环境想把url为`https://mp.weixin.qq.com/s/abcdefg`的文章转成markdown存到 `D:\wechatmp_bak\abc.md`
例如windows环境想把url为`https://mp.weixin.qq.com/s/a=1&b=2`的文章(假设文章标题为"2022年度总结"转成markdown存到 `D:\wechatmp_bak`下,文章内的**图片**保存到**本地**
则cmd执行
```
wechatmp2makrdown_win64.exe https://mp.weixin.qq.com/s/a=1&b=2 D:\wechatmp_bak --image=save
```
markdown和图片文件将保存在 `D:\wechatmp_bak\2022年度总结\`
则cmd执行 `wechatmp2makrdown_win64.exe https://mp.weixin.qq.com/s/abcdefg D:\wechatmp_bak\abc.md`
### web server 模式
通过web服务使用
执行命令:`本程序可执行文件 server [port]`
- `port` 监听的端口
当看到 `wechatmp2markdown server listening on :[port]` 时,
打开浏览器或curl工具访问`localhost:[port]?url=[url]`
- `url` 微信公众号文章网页的url
打开浏览器或curl工具访问`localhost:[port]?url=[url]&image=[image]`
- `url` 微信公众号文章网页的url
- `image` 可选参数文章内图片的保存方式参数值与上文CLI模式的相同
返回的数据即为该文章的markdown文件
返回的数据即为该文章的markdown文件若image=save则返回的是zip格式的压缩包
例如windows环境服务启动并监听8080端口想把url为`https://mp.weixin.qq.com/s/abcdefg`的文章转成markdown并下载
例如windows环境服务启动并监听8080端口想把url为`https://mp.weixin.qq.com/s/a=1&b=2`的文章转成markdown并下载,文章内的**图片**保存到**本地**
则cmd执行 `wechatmp2makrdown_win64.exe server 8080`
浏览器访问:`localhost:8080?url=https://mp.weixin.qq.com/s/abcdefg`
浏览器访问:`localhost:8080?url=https://mp.weixin.qq.com/s/a=1&b=2&image=save`
将返回一个zip文件
## 开发
### 编译