🔥 移除【WPS】邀请脚本;

🔨 添加 tg 代理设置&以及反向代理 api 功能(待测试)
This commit is contained in:
shitao 2021-05-05 14:41:11 +08:00
parent a4784e634e
commit e565e6f315
7 changed files with 37 additions and 56 deletions

View File

@ -45,6 +45,8 @@ jobs:
QMSG_TYPE: ${{secrets.QMSG_TYPE}} QMSG_TYPE: ${{secrets.QMSG_TYPE}}
TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}} TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}}
TG_USER_ID: ${{secrets.TG_USER_ID}} TG_USER_ID: ${{secrets.TG_USER_ID}}
TG_API_HOST: ${{secrets.TG_API_HOST}}
TG_PROXY: ${{secrets.TG_PROXY}}
COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}} COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}}
COOLPUSHQQ: ${{secrets.COOLPUSHQQ}} COOLPUSHQQ: ${{secrets.COOLPUSHQQ}}
COOLPUSHWX: ${{secrets.COOLPUSHWX}} COOLPUSHWX: ${{secrets.COOLPUSHWX}}

View File

@ -35,6 +35,8 @@ jobs:
QMSG_TYPE: ${{secrets.QMSG_TYPE}} QMSG_TYPE: ${{secrets.QMSG_TYPE}}
TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}} TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}}
TG_USER_ID: ${{secrets.TG_USER_ID}} TG_USER_ID: ${{secrets.TG_USER_ID}}
TG_API_HOST: ${{secrets.TG_API_HOST}}
TG_PROXY: ${{secrets.TG_PROXY}}
COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}} COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}}
COOLPUSHQQ: ${{secrets.COOLPUSHQQ}} COOLPUSHQQ: ${{secrets.COOLPUSHQQ}}
COOLPUSHWX: ${{secrets.COOLPUSHWX}} COOLPUSHWX: ${{secrets.COOLPUSHWX}}

View File

@ -72,6 +72,8 @@ notice_map = {
"SENDKEY": "", "SENDKEY": "",
"TG_BOT_TOKEN": "", "TG_BOT_TOKEN": "",
"TG_USER_ID": "", "TG_USER_ID": "",
"TG_API_HOST": "",
"TG_PROXY": "",
"QMSG_KEY": "", "QMSG_KEY": "",
"QMSG_TYPE": "", "QMSG_TYPE": "",
"COOLPUSHSKEY": "", "COOLPUSHSKEY": "",

View File

@ -8,6 +8,8 @@
"QMSG_TYPE": "", "QMSG_TYPE": "",
"TG_BOT_TOKEN": "", "TG_BOT_TOKEN": "",
"TG_USER_ID": "", "TG_USER_ID": "",
"TG_API_HOST": "",
"TG_PROXY": "",
"COOLPUSHSKEY": "", "COOLPUSHSKEY": "",
"COOLPUSHQQ": true, "COOLPUSHQQ": true,
"COOLPUSHWX": true, "COOLPUSHWX": true,

View File

@ -17,6 +17,8 @@
|_**QMSG_TYPE**_|qmsg 酱推送|推送|qmsg 酱推送[官方文档](https://qmsg.zendee.cn/index.html) ,如果需要推送到群填写 `group`,其他的都推送到 QQ | |_**QMSG_TYPE**_|qmsg 酱推送|推送|qmsg 酱推送[官方文档](https://qmsg.zendee.cn/index.html) ,如果需要推送到群填写 `group`,其他的都推送到 QQ |
|_**TG_BOT_TOKEN**_|telegram 推送|推送|telegram 推送 `TG_BOT_TOKEN`| |_**TG_BOT_TOKEN**_|telegram 推送|推送|telegram 推送 `TG_BOT_TOKEN`|
|_**TG_USER_ID**_|telegram 推送|推送|telegram 推送 `TG_USER_ID`| |_**TG_USER_ID**_|telegram 推送|推送|telegram 推送 `TG_USER_ID`|
|_**TG_API_HOST**_|telegram 推送|推送|Telegram api 自建的反向代理地址 例子:反向代理地址 http://aaa.bbb.ccc 则填写 aaa.bbb.ccc [简略搭建教程](https://shimo.im/docs/JD38CJDQtYy3yTd8/read) |
|_**TG_PROXY**_|telegram 推送|推送|Telegram 代理的信息,无密码例子: http://127.0.0.1:1080 有密码例子: http://username:password@127.0.0.1:1080|
|_**COOLPUSHSKEY**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 推送的 `SKEY`| |_**COOLPUSHSKEY**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 推送的 `SKEY`|
|_**COOLPUSHQQ**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 是否开启 QQ 推送,默认开启| |_**COOLPUSHQQ**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 是否开启 QQ 推送,默认开启|
|_**COOLPUSHWX**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 是否开启 微信 推送,默认关闭| |_**COOLPUSHWX**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 是否开启 微信 推送,默认关闭|
@ -194,6 +196,8 @@
"QMSG_TYPE": "", "QMSG_TYPE": "",
"TG_BOT_TOKEN": "", "TG_BOT_TOKEN": "",
"TG_USER_ID": "", "TG_USER_ID": "",
"TG_API_HOST": "",
"TG_PROXY": "",
"COOLPUSHSKEY": "", "COOLPUSHSKEY": "",
"COOLPUSHQQ": true, "COOLPUSHQQ": true,
"COOLPUSHWX": true, "COOLPUSHWX": true,

View File

@ -47,10 +47,21 @@ def message2qmsg(qmsg_key, qmsg_type, content):
return return
def message2telegram(tg_bot_token, tg_user_id, content): def message2telegram(tg_api_host, tg_proxy, tg_bot_token, tg_user_id, content):
print("Telegram 推送开始") print("Telegram 推送开始")
send_data = {"chat_id": tg_user_id, "text": content, "disable_web_page_preview": "true"} send_data = {"chat_id": tg_user_id, "text": content, "disable_web_page_preview": "true"}
requests.post(url=f"https://api.telegram.org/bot{tg_bot_token}/sendMessage", data=send_data) if tg_api_host:
url = f"https://{tg_api_host}/bot{tg_bot_token}/sendMessage"
else:
url = f"https://api.telegram.org/bot{tg_bot_token}/sendMessage"
if tg_proxy:
proxies = {
"http": tg_proxy,
"https": tg_proxy,
}
else:
proxies = None
requests.post(url=url, data=send_data, proxies=proxies)
return return
@ -106,8 +117,8 @@ def message2qywxapp(qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, con
"title": "签到通知", "title": "签到通知",
"description": content, "description": content,
"url": "https://github.com/Sitoi/dailycheckin", "url": "https://github.com/Sitoi/dailycheckin",
"btntxt": "开源项目" "btntxt": "开源项目",
} },
} }
requests.post(url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}", data=json.dumps(data)) requests.post(url=f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}", data=json.dumps(data))
return return
@ -145,6 +156,8 @@ def push_message(content_list: list, notice_info: dict):
qmsg_type = notice_info.get("qmsg_type") qmsg_type = notice_info.get("qmsg_type")
tg_bot_token = notice_info.get("tg_bot_token") tg_bot_token = notice_info.get("tg_bot_token")
tg_user_id = notice_info.get("tg_user_id") tg_user_id = notice_info.get("tg_user_id")
tg_api_host = notice_info.get("tg_api_host")
tg_proxy = notice_info.get("tg_proxy")
coolpushskey = notice_info.get("coolpushskey") coolpushskey = notice_info.get("coolpushskey")
coolpushqq = notice_info.get("coolpushqq") coolpushqq = notice_info.get("coolpushqq")
coolpushwx = notice_info.get("coolpushwx") coolpushwx = notice_info.get("coolpushwx")
@ -228,7 +241,13 @@ def push_message(content_list: list, notice_info: dict):
print("Pushplus 推送失败", e) print("Pushplus 推送失败", e)
if tg_user_id and tg_bot_token: if tg_user_id and tg_bot_token:
try: try:
message2telegram(tg_user_id=tg_user_id, tg_bot_token=tg_bot_token, content=message) message2telegram(
tg_api_host=tg_api_host,
tg_proxy=tg_proxy,
tg_user_id=tg_user_id,
tg_bot_token=tg_bot_token,
content=message,
)
except Exception as e: except Exception as e:
print("Telegram 推送失败", e) print("Telegram 推送失败", e)

View File

@ -2,7 +2,6 @@
import datetime import datetime
import json import json
import os import os
import time
import requests import requests
from requests import utils from requests import utils
@ -11,26 +10,6 @@ from requests import utils
class WPSCheckIn: class WPSCheckIn:
def __init__(self, check_item): def __init__(self, check_item):
self.check_item = check_item self.check_item = check_item
self.invite_sid = [
"V02S2UBSfNlvEprMOn70qP3jHPDqiZU00a7ef4a800341c7c3b",
"V02S2oI49T-Jp0_zJKZ5U38dIUSIl8Q00aa679530026780e96",
"V02S7tldy5ltYcikCzJ8PJQDSy_ElEs00a327c3c0026782526",
"V02SBpDdos7QiFOs_5TOLF0a80pWt-U00a94ce2c003a814a17",
"V02SBsNOf4sJZNFo4jOHdgHg7-2Tn1s00a338776000b669579",
"V02SFiqdXRGnH5oAV2FmDDulZyGDL3M00a61660c0026781be1",
"V02SPoOluAnWda0dTBYTXpdetS97tyI00a16135e002684bb5c",
"V02SWIvKWYijG6Rggo4m0xvDKj1m7ew00a8e26d3002508b828",
"V02Sb8gxW2inr6IDYrdHK_ywJnayd6s00ab7472b0026849b17",
"V02SfEpW1yy4wUUh_eEnEHpiJJuoDnE00ae12710000179aa7f",
"V02ShotJqqiWyubCX0VWTlcbgcHqtSQ00a45564e002678124c",
"V02Sr3nJ9IicoHWfeyQLiXgvrRpje6E00a240b890023270f97",
"V02StVuaNcoKrZ3BuvJQ1FcFS_xnG2k00af250d4002664c02f",
"V02SwV15KQ_8n6brU98_2kLnnFUDUOw00adf3fda0026934a7f",
"V02SC1mOHS0RiUBxeoA8NTliH2h2NGc00a803c35002693584d",
"V02ScVbtm2pQD49ArcgGLv360iqQFLs014c8062e000b6c37b6",
]
self.invite_limit = 10
@staticmethod @staticmethod
def web_sign(session, sid): def web_sign(session, sid):
@ -278,34 +257,6 @@ class WPSCheckIn:
user_info += f"\n{one_vip.get('name')}: {datetime.datetime.fromtimestamp(one_vip.get('expire_time')).strftime('%Y-%m-%d %H:%M:%S')}" user_info += f"\n{one_vip.get('name')}: {datetime.datetime.fromtimestamp(one_vip.get('expire_time')).strftime('%Y-%m-%d %H:%M:%S')}"
return user_info, userid return user_info, userid
def miniprogram_invite(self, session, invite_userid: int):
k = 0
for index, i in enumerate(self.invite_sid):
time.sleep(5)
if k < self.invite_limit:
headers = {"sid": i}
resp = session.post(
url="http://zt.wps.cn/2018/clock_in/api/invite",
headers=headers,
data={
"invite_userid": invite_userid,
"client_code": "040ce6c23213494c8de9653e0074YX30",
"client": "alipay",
},
)
if resp.status_code == 200:
try:
resp_json = resp.json()
print("邀请对象ID={}, Result: {}".format(str(index + 1).zfill(2), resp_json["result"]))
k += 1
except Exception as e:
print("邀请对象ID={0}, Result: ID已失效, 错误信息{1}".format(str(index + 1).zfill(2), e))
else:
print(
"邀请对象ID={}, 状态码: {}, 请求信息{}".format(str(index + 1).zfill(2), resp.status_code, resp.text[:25])
)
return f"邀请用户: 成功邀请 {k}"
def main(self): def main(self):
wps_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("wps_cookie").split("; ")} wps_cookie = {item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("wps_cookie").split("; ")}
session = requests.session() session = requests.session()
@ -325,8 +276,7 @@ class WPSCheckIn:
docer_sign_msg = self.docer_sign(session=session, sid=sid) docer_sign_msg = self.docer_sign(session=session, sid=sid)
miniprogram_sign_msg = self.miniprogram_sign(session=session, sid=sid) miniprogram_sign_msg = self.miniprogram_sign(session=session, sid=sid)
user_info_msg, userid = self.user_info(session=session, sid=sid) user_info_msg, userid = self.user_info(session=session, sid=sid)
miniprogram_invite_msg = self.miniprogram_invite(session=session, invite_userid=userid) msg = f"{user_info_msg}\n{web_sign_msg}\n{docer_sign_msg}\n{miniprogram_sign_msg}"
msg = f"{user_info_msg}\n{web_sign_msg}\n{docer_sign_msg}\n{miniprogram_sign_msg}\n{miniprogram_invite_msg}"
return msg return msg