新增咪搭ktv签到
This commit is contained in:
parent
29d77794d9
commit
ab47a080ad
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
### Example user template template
|
||||
### Example user template
|
||||
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
179
md_ktv.py
Normal file
179
md_ktv.py
Normal file
@ -0,0 +1,179 @@
|
||||
# auther: zdx
|
||||
# date: 01:08
|
||||
import requests, json
|
||||
import os
|
||||
import urllib3
|
||||
from wxpusher import WxPusher
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
# 抓取请求https://mk-gateway-pro.singworld.cn/mk-outside/api/sign/toSign的请求头
|
||||
# uid是咪哒号 token是登录后的token
|
||||
# 获取到后拼接格式:export md_ktv_cookie=uid@token,多个账号用&隔开
|
||||
# 发布时用
|
||||
md_ktv_cookie = os.getenv("md_ktv_cookie").split('\n')
|
||||
# 本地测试用
|
||||
# md_ktv_cookie = ['1093162775@Pre1qZy1xzr9buMMuKAj3MxmH9RoLyO_eyv_6IixRsY.kHHNJzzOJgykdffc3XnQ7MhyOS2ga-akRPfQf1oXW8Q@UID_mMu3av8x8YnTOq8J8u6rZxZGcfp3']
|
||||
|
||||
|
||||
# md_ktv_cookie = os.getenv("md_ktv_cookie").split('&')
|
||||
|
||||
# 签到
|
||||
def to_sign():
|
||||
data = {
|
||||
"uid": uid
|
||||
}
|
||||
url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/sign/toSign"
|
||||
|
||||
# 添加 verify=False 来忽略SSL证书验证
|
||||
response = requests.post(url, headers=headers, json=data, verify=False)
|
||||
|
||||
|
||||
# 播放录音15s +2
|
||||
def play_record():
|
||||
data = {
|
||||
"taskId": 4
|
||||
}
|
||||
url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/task/doneTask"
|
||||
|
||||
# 添加 verify=False 来忽略SSL证书验证
|
||||
response = requests.post(url, headers=headers, json=data, verify=False)
|
||||
|
||||
|
||||
# 点赞 +1
|
||||
def to_like():
|
||||
data = {
|
||||
"paramId": "45829_LOW_20231210183212_206925",
|
||||
"favourUid": uid,
|
||||
"favourType": 3
|
||||
}
|
||||
del_url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/favor/delete"
|
||||
# 先取消然后再点赞
|
||||
response = requests.post(del_url, headers=headers, json=data, verify=False)
|
||||
|
||||
like_url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/favor/create"
|
||||
response = requests.post(like_url, headers=headers, json=data, verify=False)
|
||||
|
||||
|
||||
# 投票 +1
|
||||
def to_vote():
|
||||
data = {
|
||||
"optionId": 19575
|
||||
}
|
||||
url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/vote/vote"
|
||||
|
||||
# 循环投票,直到返回json中的success为false
|
||||
while True:
|
||||
# 添加 verify=False 来忽略SSL证书验证
|
||||
response = requests.post(url, headers=headers, json=data, verify=False)
|
||||
if json.loads(response.text)['success'] == False:
|
||||
break
|
||||
|
||||
|
||||
# 领取所有咪豆
|
||||
def get_all_mido():
|
||||
data = {} # 如果需要发送数据,可以在这里填写你的数据字典
|
||||
url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/score/receiveWaitScore"
|
||||
|
||||
# 添加 verify=False 来忽略SSL证书验证
|
||||
response = requests.post(url, headers=headers, json=data, verify=False)
|
||||
|
||||
# print(response.status_code)
|
||||
print(json.loads(response.text)['msg'])
|
||||
# 成功后推送
|
||||
# if json.loads(response.text)['msg'] == '领取成功':
|
||||
if json.loads(response.text)['msg'] != 'null':
|
||||
# 获取咪豆数量
|
||||
url = "https://mk-gateway-pro.singworld.cn/mk-outside/api/score/getCurScore?uid=1093049864"
|
||||
response = requests.get(url, headers=headers, json=data, verify=False)
|
||||
score = json.loads(response.text)['data']
|
||||
# 获取当前可兑换的商品列表
|
||||
url = "https://wtmall-outside-pro.singworld.net/wtmall/shop/index?platformId=2"
|
||||
data = {
|
||||
"page": 1,
|
||||
"rows": 10,
|
||||
"shopId": 0,
|
||||
"productTypeCode": "2003",
|
||||
"uid": uid,
|
||||
"platformId": 2
|
||||
}
|
||||
headers2 = {
|
||||
"Host": "wtmall-outside-pro.singworld.net",
|
||||
"token": token,
|
||||
"xweb_xhr": "1",
|
||||
"uid": uid,
|
||||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/6.8.0(0x16080000) NetType/WIFI MiniProgramEnv/Mac MacWechat/WMPF MacWechat/3.8.5(0x13080510)XWEB/1100",
|
||||
"authorization": "Bearer " + token,
|
||||
"user_token": token,
|
||||
"content-type": "application/json",
|
||||
"accept": "*/*",
|
||||
"sec-fetch-site": "cross-site",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-dest": "empty",
|
||||
"referer": "https://servicewechat.com/wx689a4b8fe3fccc63/196/page-frame.html",
|
||||
"accept-language": "zh-CN,zh;q=0.9"
|
||||
}
|
||||
response = requests.post(url, headers=headers2, json=data, verify=False)
|
||||
details = json.loads(response.text)['data']['list']
|
||||
# 获取商品名称,价格
|
||||
content = ''
|
||||
# 将所有价格存入列表,用来判断是否有可兑换的商品
|
||||
price_list = []
|
||||
for i in range(len(details)):
|
||||
detail = details[i]
|
||||
name = detail['goodsName']
|
||||
price = detail['currentScore']
|
||||
price_list.append(price)
|
||||
# 拼接推送内容
|
||||
content += '第' + str(i+1) + '商品名称:' + name + ',价格:' + str(price) + '咪豆' + '\n'
|
||||
# 判断是否有可兑换的商品
|
||||
if min(price_list) <= score:
|
||||
# 获取最兑换的商品名称
|
||||
min_price = min(price_list)
|
||||
index = price_list.index(min_price)
|
||||
name = details[index]['goodsName']
|
||||
content += '当前咪豆数量:' + str(score) + ',有可兑换的商品' + '\n' + '最低价格商品名称:' + name + ',价格:' + str(min_price) + '咪豆'
|
||||
else:
|
||||
content += '当前咪豆数量:' + str(score) + ',没有可兑换的商品'
|
||||
WxPusher.send_message('咪哒K歌签到成功,当前咪豆数量:' + str(score) + '\n' + content,
|
||||
uids=[wxpusher_uid],
|
||||
token='AT_uj0Ezms54MZVD3xO5R5i1Wh3vR7nMety')
|
||||
print(content)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 遍历所有帐号
|
||||
for i in range(len(md_ktv_cookie)):
|
||||
cookie = md_ktv_cookie[i]
|
||||
uid = cookie.split('@')[0]
|
||||
token = cookie.split('@')[1]
|
||||
# 判断是否有推送uid
|
||||
if len(cookie.split('@')) == 3:
|
||||
wxpusher_uid = cookie.split('@')[2]
|
||||
headers = {
|
||||
"Host": "mk-gateway-pro.singworld.cn",
|
||||
"token": token,
|
||||
"xweb_xhr": "1",
|
||||
"uid": uid,
|
||||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/6.8.0(0x16080000) NetType/WIFI MiniProgramEnv/Mac MacWechat/WMPF MacWechat/3.8.5(0x13080510)XWEB/1100",
|
||||
"authorization": "Bearer " + token,
|
||||
"user_token": token,
|
||||
"content-type": "application/json",
|
||||
"accept": "*/*",
|
||||
"sec-fetch-site": "cross-site",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-dest": "empty",
|
||||
"referer": "https://servicewechat.com/wx689a4b8fe3fccc63/196/page-frame.html",
|
||||
"accept-language": "zh-CN,zh;q=0.9"
|
||||
}
|
||||
print(f'开始第{i + 1}个帐号签到')
|
||||
# 1.签到
|
||||
to_sign()
|
||||
# 2.播放录音15s +2
|
||||
play_record()
|
||||
# 3.点赞 +1
|
||||
to_like()
|
||||
# 4.投票 +1
|
||||
to_vote()
|
||||
# 5.领取咪豆
|
||||
get_all_mido()
|
||||
Loading…
Reference in New Issue
Block a user