wxdown 公众号离线文章保存(GO语言开发)
<h2 id="简介">简介</h2><p>本来一开始用 <code>nodejs</code> 写的,考虑大小、易操作、高性能、跨平台以及环境等问题,我就想能不能搞个不需依赖开发语言环境就能运行的。所以我就选择 <code>go</code>并且它本身就具备以上优点。作者本身是<code>java</code>开发,第一次使用 <code>go</code>所以过程也是比较艰难,好在 GPT 在学习一门新的开发语言方面还是相当给力!💪💪💪</p>
<p>这是一个用于保存公众号文章到本地离线查看的软件,支持将 HTML 文章保存至本地,并提供 HTML 转 PDF 的功能。此外,软件还支持图片素材管理,可在 Windows、Mac 和 Linux 系统上运行,使用 Go 语言开发,具备轻量级、小体积、高性能和并发支持的特点。<strong>不支持批量直接获取文章列表</strong></p>
<h2 id="功能特点">功能特点</h2>
<ul>
<li>保存公众号文章至本地</li>
<li>支持将 HTML 文章转换为 PDF 格式(需安装 wkhtmltopdf)</li>
<li>图片素材管理</li>
<li>保存原始地址</li>
<li>跨平台支持:Windows、Mac 和 Linux</li>
<li>使用 Go 语言开发,轻量级、高性能、高并发</li>
<li>提供简单易用的 Web 界面管理</li>
</ul>
<h2 id="下载">下载</h2>
<h3 id="v105当前版本">v1.0.5(当前版本)</h3>
<p>替换根目录 <code>web</code>、<code>wxdown</code> 文件重新启动完成更新</p>
<ul>
<li>解决有空格的文件夹路径问题
<ul>
<li>生成 PDF 失败 issues#4</li>
<li>无法通过浏览器打开文件夹</li>
</ul>
</li>
<li>解决首页合集无法下载 52破解</li>
<li>新增图片预览功能</li>
</ul>
<p>注意事项:</p>
<ol>
<li>不要安装在带有空格的文件路径中,避免不必要的麻烦(该问题已解决)</li>
<li>window 下无法转 PDF 据部分使用者反馈<br>
可以通过双击 <code>wkhtmltopdf.exe</code></li>
</ol>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>链接</th>
<th>文件大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.5-windows-amd64.zip</td>
<td>18.6 M</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.5-linux-amd64.zip</td>
<td>6.8 M</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.5-linux-arm64.zip</td>
<td>6.4 M</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.5-darwin-amd64.zip</td>
<td>6.5 M</td>
</tr>
<tr>
<td>macOS(M 系列)</td>
<td>wxdown-1.0.5-darwin-arm64.zip</td>
<td>6.8 M</td>
</tr>
</tbody>
</table>
<h3 id="v104">v1.0.4</h3>
<p>替换根目录 <code>web</code>、<code>wxdown</code> 文件重新启动完成更新</p>
<ul>
<li>解决 webp 图片格式无法转PDF问题</li>
<li>解决标签合集不满足分页条件错误问题 issues#4</li>
<li>新增图片集文章类型下载 示例</li>
</ul>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>文件名</th>
<th>链接</th>
<th>文件大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.4-windows-amd64.zip</td>
<td>https://864000.lanzouj.com/iWeh328yffqb</td>
<td>18.2 M</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.4-darwin-arm64.zip</td>
<td>https://864000.lanzouj.com/iyiSZ28yfi1e</td>
<td>6.6 M</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.4-linux-amd64.zip</td>
<td>https://864000.lanzouj.com/idCnP28yfbef</td>
<td>7.0 M</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.4-linux-arm64.zip</td>
<td>https://864000.lanzouj.com/igmYJ28yfcpc</td>
<td>6.6 M</td>
</tr>
<tr>
<td>macOS(Apple Silicon)</td>
<td>wxdown-1.0.4-darwin-amd64.zip</td>
<td>https://864000.lanzouj.com/iom6a28yfgwd</td>
<td>6.9 M</td>
</tr>
</tbody>
</table>
<h3 id="v103当前版本">v1.0.3(当前版本)</h3>
<p>替换根目录 <code>web</code>、<code>wxdown</code>、<code>config.yaml</code> 文件重新启动完成更新</p>
<ul>
<li>增加自定义目录名称</li>
<li>增加启动时默认在浏览器打开管理端</li>
<li>优化公众号最近更新样式问题</li>
<li>优化html、图片异步下载(可能会出现页面下载完了,图片还没有过会就好)</li>
<li>优化管理页面</li>
<li>重构代码</li>
</ul>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>文件名</th>
<th>链接</th>
<th>文件大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.3-windows-amd64.zip</td>
<td>https://864000.lanzouj.com/iR2ZM24ur81i</td>
<td>18.1 M</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.3-linux-arm64.zip</td>
<td>https://864000.lanzouj.com/iq5LZ24ur59i</td>
<td>6.0 M</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.3-linux-amd64.zip</td>
<td>https://864000.lanzouj.com/iDzcY24ur4be</td>
<td>6.3 M</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.3-darwin-arm64.zip</td>
<td>https://864000.lanzouj.com/i34G224ur3cj</td>
<td>6.0 M</td>
</tr>
<tr>
<td>macOS(Apple Silicon)</td>
<td>wxdown-1.0.3-darwin-amd64.zip</td>
<td>https://864000.lanzouj.com/iwuPf24ur2ef</td>
<td>6.3 M</td>
</tr>
</tbody>
</table>
<h3 id="v102">v1.0.2</h3>
<p>替换根目录 <code>web</code>、<code>wxdown</code>、<code>config.yaml</code> 文件重新启动完成更新</p>
<ul>
<li>增加自定义目录名称(合集)</li>
<li>增加 macOS 打开目录</li>
<li>增加 svg 内嵌图片下载</li>
<li>增加 http 基础认证(详情配置文件)</li>
<li>修改 svg 文件下载 bug</li>
<li>移除自动检测缺少目录上个版本</li>
</ul>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>版本/架构</th>
<th>大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.2-windows-amd64.exe</td>
<td>9.23MB</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.2-linux-arm64</td>
<td>8.75MB</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.2-linux-amd64</td>
<td>9.04MB</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.2-darwin-amd64</td>
<td>9.09MB</td>
</tr>
<tr>
<td>macOS(Apple Silicon)</td>
<td>wxdown-1.0.2-darwin-arm64</td>
<td>8.75MB</td>
</tr>
</tbody>
</table>
<h3 id="v101">v1.0.1</h3>
<ul>
<li>增加音频、视频下载</li>
<li>增加首页合集、标签合集下载</li>
<li>优化页面样式、自适应移动端</li>
<li>部分图片解析异常bug优化</li>
<li>替换根目录的 <code>web</code> 目录和 <code>wxdown</code> 开头可执行文件,重新启动完成更新</li>
</ul>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>版本/架构</th>
<th>大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.1-windows-amd64.exe</td>
<td>9.23MB</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.1-linux-arm64</td>
<td>8.75MB</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.1-linux-amd64</td>
<td>9.04MB</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.1-darwin-amd64</td>
<td>9.09MB</td>
</tr>
<tr>
<td>macOS(Apple Silicon)</td>
<td>wxdown-1.0.1-darwin-arm64</td>
<td>8.75MB</td>
</tr>
</tbody>
</table>
<h3 id="v100">v1.0.0</h3>
<table>
<thead>
<tr>
<th>操作系统</th>
<th>版本/架构</th>
<th>大小</th>
</tr>
</thead>
<tbody>
<tr>
<td>Windows</td>
<td>wxdown-1.0.0-windows-amd64.exe</td>
<td>9.23MB</td>
</tr>
<tr>
<td>ARM Linux</td>
<td>wxdown-1.0.0-linux-arm64</td>
<td>8.75MB</td>
</tr>
<tr>
<td>Linux</td>
<td>wxdown-1.0.0-linux-amd64</td>
<td>9.04MB</td>
</tr>
<tr>
<td>macOS</td>
<td>wxdown-1.0.0-darwin-amd64</td>
<td>9.09MB</td>
</tr>
<tr>
<td>macOS(Apple Silicon)</td>
<td>wxdown-1.0.0-darwin-arm64</td>
<td>8.75MB</td>
</tr>
</tbody>
</table>
<h2 id="安装和运行">安装和运行</h2>
<h3 id="windows">Windows</h3>
<p>包含了 <code>wkhtmltopdf</code></p>
<ol>
<li>解压缩包</li>
<li>打开目录</li>
<li>双击 <code>wxdown-1.0.0-windows-amd64.exe</code> 启动</li>
<li>浏览器访问 http://127.0.0.1:81</li>
</ol>
<p>如下所示启动成功:</p>
<pre><code class="language-bash">cwd: E:\code\go\go-wx-download
----------------------------------------
欢迎使用 wxdown 工具!
----------------------------------------
运行模式 : binary
软件版本 : 1.0.0
操作系统 : windows
系统架构 : amd64
启动时间 : 2024-05-19 00:00:00
----------------------------------------
服务信息
----------------------------------------
服务地址:
http://192.168.31.209:81 (浏览器访问)
http://192.168.202.1:81 (浏览器访问)
http://192.168.11.1:81(浏览器访问)
http://172.26.192.1:81(浏览器访问)
http://127.0.0.1:81 (浏览器访问)
采集接口:
http://192.168.31.209:81/gather/ (GET|POST|HEAD)
http://192.168.202.1:81/gather/ (GET|POST|HEAD)
http://192.168.11.1:81/gather/(GET|POST|HEAD)
http://172.26.192.1:81/gather/(GET|POST|HEAD)
http://127.0.0.1:81/gather/ (GET|POST|HEAD)
----------------------------------------
配置信息
----------------------------------------
运行路径 : E:\code\go\go-wx-download
资源路径 : E:\code\go\go-wx-download\data
</code></pre>
<h3 id="linux">Linux</h3>
<p>添加权限</p>
<pre><code class="language-bash">chmod +x wxdown-1.0.0-linux-amd64
</code></pre>
<p>启动程序</p>
<pre><code>root@mac-max:/home/wx# ./wxdown-1.0.0-linux-amd64
cwd: /home/wx
----------------------------------------
欢迎使用 wxdown 工具!
----------------------------------------
运行模式 : binary
软件版本 : 1.0.0
操作系统 : linux
系统架构 : amd64
启动时间 : 2024-05-19 00:00:00
----------------------------------------
服务信息
----------------------------------------
服务地址:
http://192.168.31.156:81 (浏览器访问)
http://172.17.0.1:81 (浏览器访问)
http://172.18.0.1:81 (浏览器访问)
http://127.0.0.1:81 (浏览器访问)
采集接口:
http://192.168.31.156:81/gather/ (GET|POST|HEAD)
http://172.17.0.1:81/gather/ (GET|POST|HEAD)
http://172.18.0.1:81/gather/ (GET|POST|HEAD)
http://127.0.0.1:81/gather/ (GET|POST|HEAD)
----------------------------------------
配置信息
----------------------------------------
运行路径 : /home/wx
资源路径 : /home/wx/data
</code></pre>
<h3 id="mac">Mac</h3>
<p>出现 <code>permission denied</code>表示没有权限</p>
<pre><code>(base) mac@macdeMacBook-Pro-3 ~ % /Users/mac/Desktop/wxdown-1.0.0-darwin-amd64/wxdown-1.0.0-darwin-amd64
zsh: permission denied: /Users/mac/Desktop/wxdown-1.0.0-darwin-amd64/wxdown-1.0.0-darwin-amd64
</code></pre>
<p>添加权限</p>
<pre><code class="language-bash">(base) mac@macdeMacBook-Pro-3 ~ % chmod +x /Users/mac/Desktop/wxdown-1.0.0-darwin-amd64/wxdown-1.0.0-darwin-amd64
</code></pre>
<p>双击 <code>wxdown-1.0.0-darwin-amd64</code> 启动或命令启动</p>
<pre><code class="language-bash">(base) mac@macdeMacBook-Pro-3 ~ %/Users/mac/Desktop/wxdown-1.0.0-darwin-amd64/wxdown-1.0.0-darwin-amd64
</code></pre>
<p>执行结果同上</p>
<p><strong>简单使用会下载和安装就可以了,后面都基本没啥用了</strong>😄😄,不用再看了</p>
<h2 id="目录结构">目录结构</h2>
<ul>
<li><code>web</code>:HTML 页面,很简单也可以自己修改
<ul>
<li><code>index.html</code> 主页面</li>
<li><code>images.html</code> 图片预览页面</li>
</ul>
</li>
<li><code>config.yaml</code>:系统全局配置文件</li>
<li><code>wxdown-1.0.0</code> 可执行文件,程序入口</li>
</ul>
<p><code>config.yaml</code></p>
<pre><code class="language-yaml"># 服务端口
port: 81
# 本地数据文件存储路径
path: ./data
# HTML 转 PDF 配置
# 下载 wkhtmltopdf 路径 https://wkhtmltopdf.org/downloads.html
# window 建议下载后将 wkhtmltopdf目录下载所有内容拷贝到项目根目录下
wkhtmltopdf:
# true 开启 false 关闭 默认关闭
enable: false
# linux 例如:/usr/local/wkhtmltopdf/bin/
# window 例如:E:\Program Files\wkhtmltopdf\bin
path:
# 采集线程配置
thread:
# 同时下载 HTML 线程数量
html: 5
# 同时下载图片线程数量
image: 10
</code></pre>
<h2 id="接口">接口</h2>
<h3 id="采集接口">采集接口</h3>
<ul>
<li><code>GET</code>仅支持单次下载,<code>POST</code> 支持批量提交,请求头类型 <code>JSON</code> 格式</li>
<li>http://127.0.0.1:81/gather/+需采集地址。就可以直接把地址发给采集软件</li>
</ul>
<table>
<thead>
<tr>
<th>地址</th>
<th>请求方式</th>
<th>请求参数</th>
<th>请求体</th>
</tr>
</thead>
<tbody>
<tr>
<td>http://127.0.0.1:81/gather/</td>
<td>GET</td>
<td>/gather/https://mp.weixin.qq.com/1</td>
<td>无</td>
</tr>
<tr>
<td></td>
<td>HEAD</td>
<td>/gather/https://mp.weixin.qq.com/1</td>
<td>无</td>
</tr>
<tr>
<td></td>
<td>POST</td>
<td>/gather/</td>
<td>["https://mp.weixin.qq.com/1","https://mp.weixin.qq.com/2",...]</td>
</tr>
</tbody>
</table>
<h4 id="书签脚本">书签脚本</h4>
<p>注意⚠️:如果启动软件的机器和浏览文章的机器不是一台机器,使用局域网 <code>IP</code>(192.168.0.xxx)替换 <code>127.0.0.1</code></p>
<pre><code class="language-js">javascript:fetch("http://127.0.0.1:81/gather/" + window.location.href,{mode:"no-cors"});
</code></pre>
<p>使用方法:</p>
<ol>
<li>浏览器书签栏➡️右键➡️添加网页...➡️名称:随便你能记住就行➡️网址:输入下面<code>js</code>脚本</li>
<li>打开浏览器公众号文章</li>
<li>点击上面添加的<strong>书签脚本</strong>软件会自动采集</li>
</ol>
<h3 id="资源接口">资源接口</h3>
<table>
<thead>
<tr>
<th>地址</th>
<th>请求方式</th>
<th>请求参数</th>
<th>请求体</th>
</tr>
</thead>
<tbody>
<tr>
<td>http://127.0.0.1:81/articles</td>
<td>GET</td>
<td>无</td>
<td>无</td>
</tr>
</tbody>
</table>
<h3 id="打开文件夹接口">打开文件夹接口</h3>
<table>
<thead>
<tr>
<th>地址</th>
<th>请求方式</th>
<th>请求参数</th>
<th>请求体</th>
</tr>
</thead>
<tbody>
<tr>
<td>http://127.0.0.1:81/open/</td>
<td>GET</td>
<td>/open/公众号名称</td>
<td>无</td>
</tr>
</tbody>
</table>
<h2 id="使用示例">使用示例</h2>
<h3 id="主页面">主页面</h3>
<p><img src="https://img2024.cnblogs.com/blog/1473548/202405/1473548-20240527102347527-1162715488.jpg"></p>
<h3 id="文章列表">文章列表</h3>
<p><img src="https://img2024.cnblogs.com/blog/1473548/202405/1473548-20240520103509289-1786339044.jpg"></p>
<h3 id="图片库">图片库</h3>
<p><img src="https://img2024.cnblogs.com/blog/1473548/202405/1473548-20240520103526041-156921126.jpg"></p>
<h2 id="开发和贡献">开发和贡献</h2>
<p>本软件使用 Go 语言开发,欢迎开发者贡献代码或提出改进建议。请在 GitHub 上提交 issue 或 pull request。</p>
<h2 id="注意事项">注意事项</h2>
<ul>
<li>请勿传播未经授权的文章或图片。</li>
<li>在保存、转换文章或管理图片时,请注意版权和法律规定。</li>
</ul>
</div>
<div id="MySignature" role="contentinfo">
哇!又赚了一天人民币<br><br>
来源:https://www.cnblogs.com/bxmm/p/18201389
頁:
[1]