Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
feat: 添加微信公众号wxpusher推送 (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoheiyo authored Mar 29, 2022
1 parent 2fa4735 commit d2eebf2
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__/
.env
Myconfig.json
config.json
.idea
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ cookie 获取方式:首先在网页登录[网易云音乐](https://music.163.c
5. [Telegram](https://telegram.org/)
6. [Bark](https://github.com/Finb/Bark)
7. [pushdeer](https://github.com/easychen/pushdeer)
8. [wxpusher](https://wxpusher.zjiecode.com)

要使用推送的话将相应的 `enable` 设为 `true`,并填写配置

Expand Down Expand Up @@ -530,6 +531,23 @@ cookie 获取方式:首先在网页登录[网易云音乐](https://music.163.c

要使用 pushdeer 的话需要填写 `pushkey`。如果使用自己搭建的服务器,请填写 `server`

##### wxpusher

```json5
"wxpusher": {
/* https://wxpusher.zjiecode.com */
"module": "wxpusher",
/* 是否启用推送 */
"enable": false,
/* 是否将多个账号的信息合并推送 */
"merge": false,
"APP_TOKEN": "",
"UID": ""
}
```

要使用 wxpusher 的话需要填写 `APP_TOKEN``UID`,点击[wxpusher](http://wxpusher.zjiecode.com/admin) 登陆创建应用获取`APP_TOKEN`,微信扫码后在用户列表获取`UID`

#### 刷单曲播放量

```json5
Expand Down
14 changes: 12 additions & 2 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"X-Real-IP": "",
/* 是否运行该账号的任务 */
"enable": true
}
}
],
"setting": {
/* 推送 */
Expand Down Expand Up @@ -119,6 +119,16 @@
"pushkey": "",
/* 是否将多个账号的信息合并推送 */
"merge": false
},
"wxpusher": {
/* https://wxpusher.zjiecode.com */
"module": "wxpusher",
/* 是否启用推送 */
"enable": false,
/* 是否将多个账号的信息合并推送 */
"merge": false,
"APP_TOKEN": "",
"UID": ""
}
},
/* 签到 */
Expand Down Expand Up @@ -303,7 +313,7 @@
"我的歌单"
],
/* 创建成功后是否自动删除该动态 */
"delete": true
"delete": true
}
},
/* 打卡刷歌 */
Expand Down
23 changes: 23 additions & 0 deletions push/wxpusher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import requests


def getKey(data):
config = data['config']
if len(config['APP_TOKEN']) == 0 or len(config['UID']) == 0:
return None
return (config['module'], config['APP_TOKEN'], config['UID'])


def push(title, mdmsg, mdmsg_compat, textmsg, config):
data = {
"appToken": config['APP_TOKEN'],
"content": mdmsg,
"summary": title,
"contentType": 3,
"topicIds": [
],
"uids": [config['UID']]
,
}
url = "http://wxpusher.zjiecode.com/api/send/message"
requests.post(url, json=data)

0 comments on commit d2eebf2

Please sign in to comment.