This commit is contained in:
Faker 2024-01-13 17:05:37 +08:00
parent 35c2f7d113
commit 1e296e4b78
3 changed files with 45 additions and 42 deletions

6
jd_mkhby1.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,8 @@
#Source::https://github.com/Hyper-Beast/JD_Scripts
"""
cron: 20 20 * * *
cron: 10 20 * * *
new Env('京东试用成功通知');
"""
import requests
import json
import time
@ -18,24 +15,19 @@ import urllib
#以下部分参考Curtin的脚本https://github.com/curtinlv/JD-Script
UserAgent = ''
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
addressid = ''.join(random.sample('1234567898647', 10))
iosVer = ''.join(random.sample(["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1))
iosV = iosVer.replace('.', '_')
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4", "10.2.2", "10.2.0", "10.1.6"], 1))
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
def userAgent():
"""
随机生成一个UA
jdapp;iPhone;10.0.4;14.2;9fb54498b32e17dfc5717744b5eaecda8366223c;network/wifi;ADID/2CF597D0-10D8-4DF8-C5A2-61FD79AC8035;model/iPhone11,1;addressid/7785283669;appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1
:return: ua
"""
def randomuserAgent():
global uuid,addressid,iosVer,iosV,clientVersion,iPhone,area,ADID,lng,lat
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
addressid = ''.join(random.sample('1234567898647', 10))
iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
iosV = iosVer.replace('.', '_')
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
lng='119.31991256596'+str(random.randint(100,999))
lat='26.1187118976'+str(random.randint(100,999))
UserAgent=''
if not UserAgent:
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
else:
@ -66,8 +58,17 @@ def printf(text):
def get_remarkinfo():
url='http://127.0.0.1:5600/api/envs'
try:
with open('/ql/config/auth.json', 'r') as f:
token=json.loads(f.read())['token']
path = '/ql/config/auth.json' # 设置青龙 auth文件地址
if not os.path.isfile(path):
path = '/ql/data/config/auth.json' # 尝试设置青龙 auth 新版文件地址
if os.path.isfile(path): # 进行文件真值判断
with open(path, "r") as file: # 上下文管理
auth = file.read() # 读取文件
file.close() # 关闭文件
auth = json.loads(auth) # 使用 json模块读取
# with open('/ql/config/auth.json', 'r') as f:
# token=json.loads(f.read())['token']
token = auth["token"] # 提取 authkey
headers={
'Accept':'application/json',
'authorization':'Bearer '+token,
@ -87,17 +88,17 @@ def get_remarkinfo():
print('读取auth.json文件出错跳过获取备注')
def get_succeedinfo(ck):
jda = "__jda=1.1.1.1.1;"
url='https://api.m.jd.com/client.action'
headers={
'accept':'application/json, text/plain, */*',
'content-type':'application/x-www-form-urlencoded',
'origin':'https://prodev.m.jd.com',
'content-length':'249',
'accept-language':'zh-CN,zh-Hans;q=0.9',
'User-Agent':userAgent(),
'User-Agent': UserAgent,
'referer':'https://prodev.m.jd.com/',
'accept-encoding':'gzip, deflate, br',
'cookie':ck
'accept-encoding':'gzip, deflate',
'cookie': ck + jda
}
data=f'appid=newtry&functionId=try_MyTrials&uuid={uuid}&clientVersion={clientVersion}&client=wh5&osVersion={iosVer}&area={area}&networkType=wifi&body=%7B%22page%22%3A1%2C%22selected%22%3A2%2C%22previewTime%22%3A%22%22%7D'
response=requests.post(url=url,headers=headers,data=data)
@ -107,19 +108,15 @@ def get_succeedinfo(ck):
if(json.loads(response.text)['data']['list'][i]['text']['text']).find('试用资格将保留')!=-1:
print(json.loads(response.text)['data']['list'][i]['trialName'])
try:
if remarkinfos[ptpin]!='':
send("京东试用待领取物品通知",'账号名称:'+remarkinfos[ptpin]+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
isnull=False
else:
except:
send("京东试用待领取物品通知",'账号名称:'+urllib.parse.unquote(ptpin)+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
isnull=False
except Exception as e:
printf(str(e))
if isnull==True:
print("没有在有效期内待领取的试用品\n\n")
except:
print('获取信息出错,可能是账号已过期')
pass
if __name__ == '__main__':
remarkinfos={}
try:
@ -144,4 +141,5 @@ if __name__ == '__main__':
printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
except Exception as e:
printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
UserAgent=randomuserAgent()
get_succeedinfo(ck)

File diff suppressed because one or more lines are too long