1 Star 0 Fork 4

yangro/自用青龙脚本库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
sbjz.py 19.26 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
# coding=utf-8
"""
每日9:00
cron: 0 0 9 * * ?
new Env("瘦吧减脂")
"""
import urllib
from urllib import parse
import requests
import notify
import time
import re
import random
import utils.tool as TOOL
import utils.getCookie as getCookie
global msg
msg = """
名称|今日|总瘦点
:--:|:--:|:--:
"""
# 获取用户总瘦点及签到天数
def getAllsdAndSignin(user):
t = TOOL.getTimeStamp()
dataTime = TOOL.getDateTime(t)
url = "https://gateway.shouba.cn/points/new/info/V2"
data = '{"_":'+str(t)+'}'
headers = {
"Host": "gateway.shouba.cn",
"Connection": "keep-alive",
"Authorization": user['cookie'],
"User-Agent": "Mozilla/5.0 (Linux; Android 11; M2011K2C Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/108.0.5359.128 Mobile Safari/537.36-Android-ShouBa",
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, */*",
"timestamp": str(t),
"Custom-Version": "3.11.98",
"Custom-Client-Type": "H5",
"appKey": "shouba_8BAV12P2a",
"Origin": "//h5.shouba.cn",
"X-Requested-With": "com.shoubakeji.shouba",
"Sec-Fetch-Site": "same-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
num = int(json['data']['points'])
print(user['name']+" ---> "+"已签到: "+str(json['data']['contSignInTotal']
)+"天 连续签到: "+str(json['data']['contSignInReward'])+"天"+"\n")
else:
num = 0
print(user['name']+" ---> "+"信息获取失败"+"\n")
print(json)
return num
# 获取全部任务
def getRenWuAll(user):
global msg
t = TOOL.getTimeStamp()
dataTime = TOOL.getDateTime(t)
url = "https://gateway.shouba.cn/points/new/task/info?_=" + str(t)
headers = {
"Host": "gateway.shouba.cn",
"Connection": "keep-alive",
"Authorization": user['cookie'],
"User-Agent": "Mozilla/5.0 (Linux; Android 11; M2011K2C Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/108.0.5359.128 Mobile Safari/537.36-Android-ShouBa",
"Accept": "application/json, text/plain, */*",
"timestamp": str(t),
"Custom-Version": "3.11.98",
"Custom-Client-Type": "H5",
"appKey": "shouba_8BAV12P2a",
"Origin": "//h5.shouba.cn",
"X-Requested-With": "com.shoubakeji.shouba",
"Sec-Fetch-Site": "same-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "//h5.shouba.cn/",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
}
res = requests.get(url=url, headers=headers)
json = res.json()
if (json['code'] != '200'):
print(user['name'] + ' ---> ' + json['msg'])
msg += user['name'] + "|" + "0" + "|" + json['msg'] + "\n\n"
return []
renWu = json['data']['newTabsContent'][1]['taskList']
rwArray = []
for rw in renWu:
rwArray.append(
{'name': rw['title'], 'msg': rw['btnInitName'], 'code': rw['code']})
return rwArray
# 领取瘦点
def lqsd(user, code):
global msg
t = TOOL.getTimeStamp()
dataTime = TOOL.getDateTime(t)
url = "https://gateway.shouba.cn/points/new/dailyTask/gainIntegralV2"
data = '{"code": '+code+', "_": '+str(t)+'}'
headers = {
"Host": "gateway.shouba.cn",
"Connection": "keep-alive",
"Authorization": user['cookie'],
"User-Agent": "Mozilla/5.0 (Linux; Android 11; M2011K2C Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/108.0.5359.128 Mobile Safari/537.36-Android-ShouBa",
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, */*",
"timestamp": str(t),
"Custom-Client-Type": "H5",
"appKey": "shouba_8BAV12P2a",
"Origin": "//h5.shouba.cn",
"X-Requested-With": "com.shoubakeji.shouba",
"Sec-Fetch-Site": "same-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "//h5.shouba.cn/",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
return int(re.findall("\d+", json['msg'])[0])
else:
return 0
# 签到
def appSignIn(user):
t = TOOL.getTimeStamp()
dataTime = TOOL.getDateTime(t)
url = "https://gateway.shouba.cn/points/new/info/V2"
data = '{"_":'+str(t)+'}'
headers = {
"Host": "gateway.shouba.cn",
"Connection": "keep-alive",
"Authorization": user['cookie'],
"User-Agent": "Mozilla/5.0 (Linux; Android 11; M2011K2C Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/108.0.5359.128 Mobile Safari/537.36-Android-ShouBa",
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, */*",
"timestamp": str(t),
"Custom-Version": "3.11.98",
"Custom-Client-Type": "H5",
"appKey": "shouba_8BAV12P2a",
"Origin": "//h5.shouba.cn",
"X-Requested-With": "com.shoubakeji.shouba",
"Sec-Fetch-Site": "same-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
num = 0
if (json['code'] == '200'):
try:
num = int(json['data']['bannerList']
['signGiftbagConfig']['amount'])
print(user['name']+" ---> "+"今日签到: "+str(num)+"\n")
except Exception as e:
print(user['name']+" ---> " + "今日签到 json没有找到")
else:
num = 0
print(user['name']+" ---> "+"签到失败失败"+"\n")
print(json)
return num
# 记录体重
def jltz(user, code):
t = TOOL.getTimeStamp()
dataTime = TOOL.getDateTime(t)
url = "https://gateway.shouba.cn/bodyfat/post/custom/upload"
data = '{"age":"28","appVersion":"3.11.98","bodyDate":"' + \
str(dataTime)+'","gender":"2","height":"160","historyId":"101","phoneType":"Redmi K20 Pro Premium Edition","systemVersion":"11","weight":"50.0"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi Redmi K20 Pro Premium Edition",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json; charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"记录体重"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"记录体重领取失败"+"\n")
print(json)
return num
# 便便打卡
def bbdk(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
url = "https://gateway.shouba.cn/shouba/excrement/saveRecord"
data = '{"colourId":"8","consumTime":"'+urllib.parse.quote(
"小于5分钟")+'","eatNum":1,"eatTime":1,"feelingId":"22","isEatProbiotics":1,"quantityId":"15","recordDate":"2023-01-15","recordTime":"02:55","shapeId":"1","smellId":"19","timeType":"2"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json; charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"便便打卡"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"便便打卡领取失败"+"\n")
print(json)
return num
# 心情打卡
def xqdk(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
url = "https://gateway.shouba.cn/shouba/motion/mood/record"
data = '{"moodStatus": "1", "recordDate": "'+str(dataTime)+'"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json;charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"心情打卡"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"心情打卡领取失败"+"\n")
print(json)
return num
# 随眠打卡
def smdk(user, code):
print("随眠打卡")
return 0
# 运动打卡
def yddk(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
url = "https://gateway.shouba.cn/shouba/exercise/post/video/clockIn"
data = '{"exerciseId":"81","recordDate":"' + \
str(dataTime)+'","validTime":"13"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json; charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"运动打卡"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"运动打卡领取失败"+"\n")
print(json)
return num
# 饮水打卡
def yshuidk(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
url = "https://gateway.shouba.cn/shouba/water/post/clockinV2"
data = '{"waterIntake":"' + \
str(random.randint(200, 400))+'","recordDate":"'+str(dataTime)+'"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json;charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"饮水打卡"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"饮水打卡领取失败"+"\n")
print(json)
return num
# 饮食打卡
def yshidk(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
url = "https://gateway.shouba.cn/shouba/dict/post/clockIn"
data = '{"clockInType":"3","foodList":[{"calorie":"83.0","clockInType":0,"colour":"1","colourValue":"#21CE97","content":"'+urllib.parse.quote(
"放心吃")+'","date":"'+str(dataTime)+'","foodId":"237873","foodName":"'+urllib.parse.quote(
"脂20营养固体饮料")+'","imagePath":"https://thinbaross.shouba.cn/uploads/school/images/20210108/e0bb9758de826936b182faf9ffbfbde6.jpg","isZhi20":true,"num":"1.0","self":false,"singleCalorie":"83.0","title":"'+urllib.parse.quote(
"早餐")+'","unit":"'+urllib.parse.quote(
"袋")+'"}],"recordDate":"'+str(dataTime)+'","type":"1"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json; charset=UTF-8",
"Content-Length": "442",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"饮食打卡"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"饮食打卡领取失败"+"\n")
print(json)
return num
# 点赞
def likes(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
for i in range(6):
index = str(random.randint(1300, 1500))
url = "https://gateway.shouba.cn/circle/celebrity/collectSystemArticles"
data = '{"types":"2","aid":'+str(index)+',"isList":"0"}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi M2011K2C",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json;charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
time.sleep(1.5)
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"点赞五次内容"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"点赞五次内容领取失败"+"\n")
print(json)
return num
# 分享五次
def share(user, code):
t = TOOL.getTimeStamp()
dataTime = time.strftime('%Y-%m-%d', time.localtime(t/1000))
for i in range(6):
index = str(random.randint(225171, 225299))
url = "https://gateway.shouba.cn/userShare/shareAddRecordCallback"
data = '{"shareType":"3","contentId":"' + \
str(index)+'","shareChannel":"101","authorType":"5","authorId":"188161","shareId":"","shareUrl":""}'
headers = {
"Authorization": user['cookie'],
"version": "3.11.98",
"Custom-Version": "3.11.98",
"Custom-Client-Type": "android",
"Custom-Channel": "store",
"Download-Channel": "1",
"OSModel": "Xiaomi Redmi K20 Pro Premium Edition",
"OSVersion": "android 11",
"appKey": "shouba_zHmU1kOo9",
"timestamp": str(t),
"appId": "com.shoubakeji.shouba",
"Content-Type": "application/json;charset=UTF-8",
"Host": "gateway.shouba.cn",
"Connection": "Keep-Alive",
"User-Agent": "okhttp/3.14.7"
}
res = requests.post(url=url, data=data, headers=headers)
json = res.json()
time.sleep(1.5)
if (json['code'] == '200'):
#成功, 领取
num = lqsd(user, code)
print(user['name']+" ---> "+"分享五次"+str(num)+"\n")
else:
# 失败
num = 0
print(user['name']+" ---> "+"分享五次领取失败"+"\n")
print(json)
return num
def main():
users = getCookie.GetQlEnvs().getCookies('SBJZ_TOKEN')
print("🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉\n")
print("获取到: "+str(len(users))+" 个用户")
print("-------------------------------------------")
for user in users:
signIn(user)
time.sleep(1.5)
# 签到
def signIn(user):
global msg
num = 0
rwarray = getRenWuAll(user)
num += appSignIn(user)
for rw in rwarray:
name = rw['name']
_msg = rw['msg']
code = rw['code']
if (name == '记录体重' and _msg == '去完成' or _msg == '领取'):
num += jltz(user, code)
elif (name == '便便打卡' and _msg == '去打卡' or _msg == '领取'):
num += bbdk(user, code)
elif (name == '心情打卡' and _msg == '去打卡' or _msg == '领取'):
num += xqdk(user, code)
elif (name == '睡眠打卡' and _msg == '去打卡' or _msg == '领取'):
num += smdk(user, code)
elif (name == '运动打卡' and _msg == '去打卡' or _msg == '领取'):
num += yddk(user, code)
elif (name == '饮水打卡' and _msg == '去打卡' or _msg == '领取'):
num += yshuidk(user, code)
elif (name == '饮食打卡' and _msg == '去打卡' or _msg == '领取'):
num += yshidk(user, code)
elif (name == '点赞5次内容' and _msg == '去点赞' or _msg == '领取'):
num += likes(user, code)
elif (name == '分享5次内容' and _msg == '去分享' or _msg == '领取'):
num += share(user, code)
time.sleep(0.3)
allsd = getAllsdAndSignin(user)
print(user['name'] + " ---> " +
"总领取["+str(num)+"]"+"总瘦点: "+str(allsd)+"\n")
msg += user['name'] + "|" + str(num) + "|" + str(allsd) + "\n\n"
print("-------------------------------------------\n")
main()
print("🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉")
notify.send("瘦吧减脂", msg)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yangro/ql.git
git@gitee.com:yangro/ql.git
yangro
ql
自用青龙脚本库
main

搜索帮助