# wechat-article-exporter **Repository Path**: happywhr/wechat-article-exporter ## Basic Information - **Project Name**: wechat-article-exporter - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-24 - **Last Updated**: 2026-05-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 公众号信息采集系统 © 2026 爱玛研发战略Marketing ## 【使用说明】 1. 解压 zip 到任意文件夹 2. 双击 start.bat (首次运行会自动安装 Node.js,约 30MB,需要网络) 3. 浏览器访问 http://localhost:3000 ## 【注意事项】 - 服务运行期间请保持「start.bat」窗口开启,关闭窗口即停止服务 - 如需更换端口,编辑同目录下的 .env 文件,修改 NITRO_PORT=3000 中的数字 - 每位使用者需用自己的微信公众号账号扫码登录,数据互不影响 ## 【前提:注册微信公众号】 本工具需要通过微信公众号后台账号登录,若尚未注册,请按以下步骤操作: 注册地址:https://mp.weixin.qq.com ### 注册流程 **第一步 打开注册页面** 浏览器访问 https://mp.weixin.qq.com,点击右上角「立即注册」 **第二步 选择账号类型** 建议选择「订阅号」,个人即可注册,无需企业资质 **第三步 填写注册邮箱** - 填写未注册过公众号的邮箱 - 点击「激活邮箱」,登录邮箱点击激活链接 - 设置登录密码 **第四步 选择主体类型** - 个人使用:选「个人」 - 企业/部门使用:选「企业」(需营业执照) **第五步 身份验证(个人)** - 填写真实姓名和身份证号 - 用本人微信扫码完成验证 **第六步 填写公众号信息** - 公众号名称(注册后可修改一次) - 功能介绍(简要描述即可) - 选择运营地区 **第七步 注册完成** 登录 https://mp.weixin.qq.com,进入公众号后台即表示注册成功 ### 登录本工具 1. 启动本工具后,浏览器访问 http://localhost:3000 2. 点击「扫码登录」,使用注册公众号时绑定的微信扫描二维码 3. 扫码成功后即可开始采集文章 > **注意**:扫码登录使用的是「公众号管理员微信」,不是公众号本身的账号密码。 ## 【编译与部署方法】 ### 环境要求 - Node.js >= v22 - yarn 1.22.22 ### 启动方式 | 启动方式 | 适用场景 | 命令/操作 | |---|---|---| | **双击 start.bat** | 普通用户快速启动 | 直接双击根目录 `start.bat` | | **Node 命令启动** | 开发者调试 | `node .output/server/index.mjs` | | **部署脚本启动** | 生产环境(推荐) | `.\deploy-windows.ps1` | | **PM2 管理** | 生产环境运维 | `pm2 restart wechat-exporter` | ### 手动编译部署 ```powershell # 启用 Corepack 并安装 yarn corepack enable corepack prepare yarn@1.22.22 --activate # 克隆代码(有本地代码的话并且不需要更新的话,可以忽略该命令) git clone https://gitee.com/happywhr/wechat-article-exporter.git cd wechat-article-exporter # 配置环境变量 copy .env.example .env # 安装依赖(首次约 5~10 分钟) yarn # 构建 yarn build # 运行 node .output/server/index.mjs ``` ### 自动部署(推荐) 以**管理员身份**打开 PowerShell,执行以下命令: ```powershell # 第一步:解除脚本执行限制(仅首次需要) Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # 第二步:克隆代码 git clone https://gitee.com/happywhr/wechat-article-exporter.git cd wechat-article-exporter # 第三步:运行部署脚本 .\deploy-windows.ps1 ``` 脚本会自动完成:Node.js 检查 → yarn 配置 → 依赖安装 → 构建 → PM2 启动 → 开机自启设置。 **可选参数:** ```powershell .\deploy-windows.ps1 -Port 8080 # 自定义端口(默认 3000) .\deploy-windows.ps1 -SkipBuild # 跳过构建,仅重启服务 .\deploy-windows.ps1 -Uninstall # 卸载 PM2 服务 ``` **更新到最新版本:** ```powershell .\deploy-windows.ps1 # 自动 git pull + 重新构建 + 重启 ``` ### PM2 常用命令 ```powershell pm2 status # 查看服务状态 pm2 logs wechat-exporter # 查看实时日志 pm2 restart wechat-exporter # 重启服务 pm2 stop wechat-exporter # 停止服务 ``` ### 环境变量说明 编辑根目录 `.env` 文件: | 变量名 | 默认值 | 说明 | |---|---|---| | `NITRO_KV_DRIVER` | `memory` | 存储驱动,本地/Docker 用 `fs` | | `NITRO_KV_BASE` | `.data/kv` | KV 数据目录(`fs` 模式) | | `NITRO_PORT` | `3000` | 服务监听端口 | ### 数据持久化说明 | 数据 | 存储位置 | 重启后 | |---|---|---| | 文章列表、已采集内容 | 浏览器 IndexedDB | ✅ 保留 | | 登录 Token | 服务端 `.data/kv/` | ✅ 保留(4 天有效期) | > ⚠️ IndexedDB 按域名+端口隔离,换域名/端口访问历史数据不互通。 ### 常见问题 | 问题 | 解决方案 | |---|---| | PowerShell 禁止运行脚本 | `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` | | yarn 安装依赖慢 | `yarn config set registry https://registry.npmmirror.com` | | 3000 端口被占用 | `.env` 中添加 `NITRO_PORT=8080` | | 登录后提示"未登录" | 确认使用 Chrome/Edge 浏览器,服务重新构建部署后重新登录 |