https://github.com/coder2z/weixin-blog
对博客进行爬虫,然后推送到微信公众号
https://github.com/coder2z/weixin-blog
Last synced: 3 months ago
JSON representation
对博客进行爬虫,然后推送到微信公众号
- Host: GitHub
- URL: https://github.com/coder2z/weixin-blog
- Owner: coder2z
- Created: 2020-07-13T12:27:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T05:01:29.000Z (almost 5 years ago)
- Last Synced: 2025-01-11T03:56:59.964Z (4 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 博客微信公众号推送
主要是把博客的发布的新文章推送到微信公众号。
# 项目启动
## 配置config
在config下的config.yml文件。
## 在redis中添加需要爬虫的网站
```
//key固定为key
//field为需要爬虫的网站
//field为需要爬取的数据的路由正则(比如:https://myxy99.cn/posts/[^\s] 就是爬取所有路由为https://myxy99.cn/posts开始的)
hset key field value// 示例
// hset BlogUrl https://myxy99.cn https://myxy99.cn/posts/[^\s]```
## 启动爬虫
```
cd cmd
go build spider.go
./spider
```
## 发送公众号
```
cd cmd
go build wx.go
./wx
```# 定时发送
可以使用liunx的crontab操作
```vim /etc/crontab```
在末尾添加
每天凌晨2点执行
```* 02 * * * user-name cd /{项目目录}/cmd && ./spider```
每天凌晨2点10分执行
```10 02 * * * user-name cd /{项目目录}/cmd && ./wx```