mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
update
This commit is contained in:
parent
9950cb2037
commit
d06e7f1f3f
15
jdCookie.py
15
jdCookie.py
@ -7,15 +7,14 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import logging
|
from functools import partial
|
||||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
print = partial(print, flush=True)
|
||||||
logger = logging.getLogger()
|
|
||||||
|
|
||||||
|
|
||||||
def get_cookies():
|
def get_cookies():
|
||||||
CookieJDs = []
|
CookieJDs = []
|
||||||
if os.environ.get("JD_COOKIE"):
|
if os.environ.get("JD_COOKIE"):
|
||||||
logger.info("已获取并使用Env环境 Cookie")
|
print("已获取并使用Env环境 Cookie")
|
||||||
if '&' in os.environ["JD_COOKIE"]:
|
if '&' in os.environ["JD_COOKIE"]:
|
||||||
CookieJDs = os.environ["JD_COOKIE"].split('&')
|
CookieJDs = os.environ["JD_COOKIE"].split('&')
|
||||||
elif '\n' in os.environ["JD_COOKIE"]:
|
elif '\n' in os.environ["JD_COOKIE"]:
|
||||||
@ -37,13 +36,13 @@ def get_cookies():
|
|||||||
CookieJDs = sorted(set(CookieJDs), key=CookieJDs.index)
|
CookieJDs = sorted(set(CookieJDs), key=CookieJDs.index)
|
||||||
# return CookieJDs
|
# return CookieJDs
|
||||||
else:
|
else:
|
||||||
logger.info("未获取到正确✅格式的京东账号Cookie")
|
print("未获取到正确✅格式的京东账号Cookie")
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.info(f"====================共{len(CookieJDs)}个京东账号Cookie=========\n")
|
print(f"====================共{len(CookieJDs)}个京东账号Cookie=========\n")
|
||||||
logger.info(f"==================脚本执行- 北京时间(UTC+8):{time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}=====================\n")
|
print(f"==================脚本执行- 北京时间(UTC+8):{time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}=====================\n")
|
||||||
return CookieJDs
|
return CookieJDs
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
# if __name__ == "__main__":
|
||||||
# get_cookies()
|
# get_cookies()
|
||||||
# logger.info(os.environ.get("JD_COOKIE"))
|
# print(os.environ.get("JD_COOKIE"))
|
||||||
|
@ -23,9 +23,8 @@ from datetime import datetime
|
|||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
from urllib.parse import quote_plus, unquote_plus
|
from urllib.parse import quote_plus, unquote_plus
|
||||||
import logging
|
from functools import partial
|
||||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
print = partial(print, flush=True)
|
||||||
logger = logging.getLogger()
|
|
||||||
import warnings
|
import warnings
|
||||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ try:
|
|||||||
from jdCookie import get_cookies
|
from jdCookie import get_cookies
|
||||||
getCk = get_cookies()
|
getCk = get_cookies()
|
||||||
except:
|
except:
|
||||||
logger.info("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||||
redis_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
redis_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||||
@ -45,12 +44,13 @@ inviterNicks = [
|
|||||||
"pWGUWZJQ3actex0X2vQyLsjNhNaYFy2HteErE6izlhTf9nrGY7gBkCdGU4C6z%2FxD"
|
"pWGUWZJQ3actex0X2vQyLsjNhNaYFy2HteErE6izlhTf9nrGY7gBkCdGU4C6z%2FxD"
|
||||||
]
|
]
|
||||||
if "&" not in jinggengInviteJoin:
|
if "&" not in jinggengInviteJoin:
|
||||||
logger.info("⚠️jinggengInviteJoin变量有误!退出程序!")
|
print("⚠️jinggengInviteJoin变量有误!退出程序!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
ac_id = jinggengInviteJoin.split("&")[0]
|
ac_id = jinggengInviteJoin.split("&")[0]
|
||||||
user_id = jinggengInviteJoin.split("&")[1]
|
user_id = jinggengInviteJoin.split("&")[1]
|
||||||
inviterNick = random.choice(inviterNicks)
|
inviterNick = random.choice(inviterNicks)
|
||||||
activity_url = f"https://jinggeng-isv.isvjcloud.com/ql/front/showInviteJoin?id={ac_id}&user_id={user_id}&inviterNick={inviterNick}"
|
activity_url = f"https://jinggeng-isv.isvjcloud.com/ql/front/showInviteJoin?id={ac_id}&user_id={user_id}&inviterNick={inviterNick}"
|
||||||
|
print(f"【🛳活动入口】{activity_url}")
|
||||||
|
|
||||||
def redis_conn():
|
def redis_conn():
|
||||||
try:
|
try:
|
||||||
@ -59,12 +59,12 @@ def redis_conn():
|
|||||||
pool = redis.ConnectionPool(host=redis_url, port=6379, decode_responses=True, socket_connect_timeout=5, password=redis_pwd)
|
pool = redis.ConnectionPool(host=redis_url, port=6379, decode_responses=True, socket_connect_timeout=5, password=redis_pwd)
|
||||||
r = redis.Redis(connection_pool=pool)
|
r = redis.Redis(connection_pool=pool)
|
||||||
r.get('conn_test')
|
r.get('conn_test')
|
||||||
logger.info('✅redis连接成功')
|
print('✅redis连接成功')
|
||||||
return r
|
return r
|
||||||
except:
|
except:
|
||||||
logger.info("⚠️redis连接异常")
|
print("⚠️redis连接异常")
|
||||||
except:
|
except:
|
||||||
logger.info("⚠️缺少redis依赖,请运行pip3 install redis")
|
print("⚠️缺少redis依赖,请运行pip3 install redis")
|
||||||
|
|
||||||
def getToken(ck, r=None):
|
def getToken(ck, r=None):
|
||||||
try:
|
try:
|
||||||
@ -76,12 +76,12 @@ def getToken(ck, r=None):
|
|||||||
try:
|
try:
|
||||||
if r is not None:
|
if r is not None:
|
||||||
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
||||||
# logger.info("Token过期时间", r.ttl(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}'))
|
# print("Token过期时间", r.ttl(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}'))
|
||||||
if Token is not None:
|
if Token is not None:
|
||||||
logger.info(f"♻️获取缓存Token->: {Token}")
|
print(f"♻️获取缓存Token->: {Token}")
|
||||||
return Token
|
return Token
|
||||||
else:
|
else:
|
||||||
logger.info("🈳去设置Token缓存-->")
|
print("🈳去设置Token缓存-->")
|
||||||
s.headers = {
|
s.headers = {
|
||||||
'Connection': 'keep-alive',
|
'Connection': 'keep-alive',
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
@ -94,20 +94,20 @@ def getToken(ck, r=None):
|
|||||||
'Accept': '*/*'
|
'Accept': '*/*'
|
||||||
}
|
}
|
||||||
sign_txt = sign({"url": f"{activityUrl}", "id": ""}, 'isvObfuscator')
|
sign_txt = sign({"url": f"{activityUrl}", "id": ""}, 'isvObfuscator')
|
||||||
# logger.info(sign_txt)
|
# print(sign_txt)
|
||||||
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
||||||
if f.status_code != 200:
|
if f.status_code != 200:
|
||||||
logger.info(f.status_code)
|
print(f.status_code)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if "参数异常" in f.text:
|
if "参数异常" in f.text:
|
||||||
return
|
return
|
||||||
Token_new = f.json()['token']
|
Token_new = f.json()['token']
|
||||||
logger.info(f"Token->: {Token_new}")
|
print(f"Token->: {Token_new}")
|
||||||
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
||||||
logger.info("✅Token缓存设置成功")
|
print("✅Token缓存设置成功")
|
||||||
else:
|
else:
|
||||||
logger.info("❌Token缓存设置失败")
|
print("❌Token缓存设置失败")
|
||||||
return Token_new
|
return Token_new
|
||||||
else:
|
else:
|
||||||
s.headers = {
|
s.headers = {
|
||||||
@ -122,16 +122,16 @@ def getToken(ck, r=None):
|
|||||||
'Accept': '*/*'
|
'Accept': '*/*'
|
||||||
}
|
}
|
||||||
sign_txt = sign({"url": f"{activityUrl}", "id": ""}, 'isvObfuscator')
|
sign_txt = sign({"url": f"{activityUrl}", "id": ""}, 'isvObfuscator')
|
||||||
# logger.info(sign_txt)
|
# print(sign_txt)
|
||||||
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
||||||
if f.status_code != 200:
|
if f.status_code != 200:
|
||||||
logger.info(f.status_code)
|
print(f.status_code)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if "参数异常" in f.text:
|
if "参数异常" in f.text:
|
||||||
return
|
return
|
||||||
Token = f.json()['token']
|
Token = f.json()['token']
|
||||||
logger.info(f"Token->: {Token}")
|
print(f"Token->: {Token}")
|
||||||
return Token
|
return Token
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
@ -194,7 +194,7 @@ def getActivity(index=1, isOpenCard=0, inviterCode=None, getIndex=0):
|
|||||||
response = requests.request("GET", url, headers=headers)
|
response = requests.request("GET", url, headers=headers)
|
||||||
html_text = response.text
|
html_text = response.text
|
||||||
if response.status_code == 493:
|
if response.status_code == 493:
|
||||||
logger.info(response.status_code, "⚠️ip疑似黑了,休息一会再来撸~")
|
print(response.status_code, "⚠️ip疑似黑了,休息一会再来撸~")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
# if response.cookies:
|
# if response.cookies:
|
||||||
cookies = response.cookies.get_dict()
|
cookies = response.cookies.get_dict()
|
||||||
@ -219,7 +219,7 @@ def getActivity(index=1, isOpenCard=0, inviterCode=None, getIndex=0):
|
|||||||
shop_sid = soup.find('input', attrs={'id': 'shop_sid'})['value']
|
shop_sid = soup.find('input', attrs={'id': 'shop_sid'})['value']
|
||||||
inviteSuccNums = (soup.find('input', attrs={'id': 'helpLogs'})['value'])
|
inviteSuccNums = (soup.find('input', attrs={'id': 'helpLogs'})['value'])
|
||||||
inviteSetting2s = eval(soup.find('input', attrs={'id': 'inviteSetting2'})['value'])
|
inviteSetting2s = eval(soup.find('input', attrs={'id': 'inviteSetting2'})['value'])
|
||||||
logger.info(f"店铺名称: {shop_title} \n活动名称: {actName} \n店铺ID: {shop_sid}")
|
print(f"店铺名称: {shop_title} \n活动名称: {actName} \n店铺ID: {shop_sid}")
|
||||||
num1 = {'1': 'one', '2': 'two', '3': 'three', '4': 'four'}
|
num1 = {'1': 'one', '2': 'two', '3': 'three', '4': 'four'}
|
||||||
num2 = {'1': 'leveOneNum', '2': 'leveTwoNum', '3': 'leveThreeNum', '4': 'leveFourNum'}
|
num2 = {'1': 'leveOneNum', '2': 'leveTwoNum', '3': 'leveThreeNum', '4': 'leveFourNum'}
|
||||||
needInviteNums = []
|
needInviteNums = []
|
||||||
@ -238,16 +238,16 @@ def getActivity(index=1, isOpenCard=0, inviterCode=None, getIndex=0):
|
|||||||
denomination = inviteSetting2['denomination']
|
denomination = inviteSetting2['denomination']
|
||||||
awardId = inviteSetting2['id']
|
awardId = inviteSetting2['id']
|
||||||
# inviteSucc = soup.find('input', attrs={'id': 'inviteSucc'})['value']
|
# inviteSucc = soup.find('input', attrs={'id': 'inviteSucc'})['value']
|
||||||
logger.info(f"奖品{b}: {equityName} 奖励: {denomination} 总数: {freezeQuantity}份 剩余: {availableQuantity}份 需要邀请: {leveNum}人")
|
print(f"奖品{b}: {equityName} 奖励: {denomination} 总数: {freezeQuantity}份 剩余: {availableQuantity}份 需要邀请: {leveNum}人")
|
||||||
if availableQuantity > 0:
|
if availableQuantity > 0:
|
||||||
needInviteNums.append((leveNum, awardId, equityType))
|
needInviteNums.append((leveNum, awardId, equityType))
|
||||||
if len(needInviteNums) == 0:
|
if len(needInviteNums) == 0:
|
||||||
logger.info(f"⛈⛈⛈活动奖品全部发完啦!")
|
print(f"⛈⛈⛈活动奖品全部发完啦!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
return errorMsg, inviteSuccNums, needInviteNums
|
return errorMsg, inviteSuccNums, needInviteNums
|
||||||
return errorMsg0
|
return errorMsg0
|
||||||
elif "活动已结束" in html_text:
|
elif "活动已结束" in html_text:
|
||||||
logger.info("😭活动已结束,下次早点来~")
|
print("😭活动已结束,下次早点来~")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
return set_cookie
|
return set_cookie
|
||||||
@ -276,7 +276,7 @@ def setMixNick(token):
|
|||||||
refresh_cookies(response)
|
refresh_cookies(response)
|
||||||
return setMixNick0
|
return setMixNick0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(e)
|
print(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
def recordActPvUvdata(token):
|
def recordActPvUvdata(token):
|
||||||
@ -351,12 +351,12 @@ def bindWithVender(cookie):
|
|||||||
if res['success']:
|
if res['success']:
|
||||||
open_result = res['message']
|
open_result = res['message']
|
||||||
if "火爆" in open_result:
|
if "火爆" in open_result:
|
||||||
logger.info(f"\t⛈⛈⛈{open_result}")
|
print(f"\t⛈⛈⛈{open_result}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"\t🎉🎉🎉{open_result}")
|
print(f"\t🎉🎉🎉{open_result}")
|
||||||
return res['message']
|
return res['message']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(e)
|
print(e)
|
||||||
|
|
||||||
def receiveInviteJoinAward(token, awardId):
|
def receiveInviteJoinAward(token, awardId):
|
||||||
url = "https://jinggeng-isv.isvjcloud.com/ql/front/receiveInviteJoinAward"
|
url = "https://jinggeng-isv.isvjcloud.com/ql/front/receiveInviteJoinAward"
|
||||||
@ -382,9 +382,9 @@ def receiveInviteJoinAward(token, awardId):
|
|||||||
if msg['isSendSucc']:
|
if msg['isSendSucc']:
|
||||||
awardType = msg['drawAwardDto']['awardType'].replace('JD_BEAN', '京豆').replace('JD_POINT', '积分')
|
awardType = msg['drawAwardDto']['awardType'].replace('JD_BEAN', '京豆').replace('JD_POINT', '积分')
|
||||||
awardDenomination = msg['drawAwardDto']['awardDenomination']
|
awardDenomination = msg['drawAwardDto']['awardDenomination']
|
||||||
logger.info(f"\t🎉🎉成功领取{awardDenomination}{awardType}")
|
print(f"\t🎉🎉成功领取{awardDenomination}{awardType}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"\t🎉🎉{res['msg']}")
|
print(f"\t🎉🎉{res['msg']}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -394,7 +394,7 @@ if __name__ == '__main__':
|
|||||||
if not cks:
|
if not cks:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
except:
|
except:
|
||||||
logger.info("未获取到有效COOKIE,退出程序!")
|
print("未获取到有效COOKIE,退出程序!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
global inviterCode, inviteSuccNums, activityUrl, needInviteNums, rewardIndex, firstCk
|
global inviterCode, inviteSuccNums, activityUrl, needInviteNums, rewardIndex, firstCk
|
||||||
inviteSuccNums = 0
|
inviteSuccNums = 0
|
||||||
@ -408,7 +408,7 @@ if __name__ == '__main__':
|
|||||||
if num == 1:
|
if num == 1:
|
||||||
firstCk = cookie
|
firstCk = cookie
|
||||||
if num % 5 == 0:
|
if num % 5 == 0:
|
||||||
logger.info("⏰等待5s")
|
print("⏰等待5s")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
global ua, activityCookie, token, getIndex
|
global ua, activityCookie, token, getIndex
|
||||||
getIndex = 0
|
getIndex = 0
|
||||||
@ -418,8 +418,8 @@ if __name__ == '__main__':
|
|||||||
pt_pin = unquote_plus(pt_pin)
|
pt_pin = unquote_plus(pt_pin)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pt_pin = f'用户{num}'
|
pt_pin = f'用户{num}'
|
||||||
logger.info(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||||
logger.info(datetime.now())
|
print(datetime.now())
|
||||||
token = ''
|
token = ''
|
||||||
activityCookie = ''
|
activityCookie = ''
|
||||||
activityCookie = getActivity(num, 0, inviterCode, 0)
|
activityCookie = getActivity(num, 0, inviterCode, 0)
|
||||||
@ -427,54 +427,54 @@ if __name__ == '__main__':
|
|||||||
token = getToken(cookie, r)
|
token = getToken(cookie, r)
|
||||||
if token is None:
|
if token is None:
|
||||||
if num == 1:
|
if num == 1:
|
||||||
logger.info(f"⚠️车头获取Token失败,退出本程序!")
|
print(f"⚠️车头获取Token失败,退出本程序!")
|
||||||
# sys.exit()
|
# sys.exit()
|
||||||
os._exit()
|
os._exit()
|
||||||
logger.info(f"⚠️获取Token失败!⏰等待3s")
|
print(f"⚠️获取Token失败!⏰等待3s")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
logger.info(f"⚠️获取Token失败!⏰等待3s")
|
print(f"⚠️获取Token失败!⏰等待3s")
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
continue
|
continue
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
setMixNick0 = setMixNick(token)
|
setMixNick0 = setMixNick(token)
|
||||||
if setMixNick0 is None:
|
if setMixNick0 is None:
|
||||||
if num == 1:
|
if num == 1:
|
||||||
logger.info(f"⚠️车头获取邀请码失败,退出本程序!")
|
print(f"⚠️车头获取邀请码失败,退出本程序!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
logger.info(f"邀请码->: {setMixNick0}")
|
print(f"邀请码->: {setMixNick0}")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
logger.info(f"准备助力-->: {inviterCode}")
|
print(f"准备助力-->: {inviterCode}")
|
||||||
inviteSuccNum = getActivity(num, 0, inviterCode, 1)
|
inviteSuccNum = getActivity(num, 0, inviterCode, 1)
|
||||||
if num == 1:
|
if num == 1:
|
||||||
errorMsg0 = inviteSuccNum[0]
|
errorMsg0 = inviteSuccNum[0]
|
||||||
if "跳开卡页面" not in errorMsg0:
|
if "跳开卡页面" not in errorMsg0:
|
||||||
logger.info("无法助力自己")
|
print("无法助力自己")
|
||||||
inviteSuccNums0 = inviteSuccNum[1]
|
inviteSuccNums0 = inviteSuccNum[1]
|
||||||
needInviteNums = inviteSuccNum[2]
|
needInviteNums = inviteSuccNum[2]
|
||||||
inviteSuccNums = len(eval(inviteSuccNums0))
|
inviteSuccNums = len(eval(inviteSuccNums0))
|
||||||
logger.info(f"🛳已经邀请{inviteSuccNums}人")
|
print(f"🛳已经邀请{inviteSuccNums}人")
|
||||||
for i, needNum0 in enumerate(needInviteNums):
|
for i, needNum0 in enumerate(needInviteNums):
|
||||||
needNum = needNum0[0]
|
needNum = needNum0[0]
|
||||||
awardId = needNum0[1]
|
awardId = needNum0[1]
|
||||||
if inviteSuccNums >= needNum:
|
if inviteSuccNums >= needNum:
|
||||||
logger.info(f"🎉恭喜已完成第{i + 1}档邀请,快去领奖吧!")
|
print(f"🎉恭喜已完成第{i + 1}档邀请,快去领奖吧!")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
recordActPvUvdata(token)
|
recordActPvUvdata(token)
|
||||||
checkTokenInSession(token)
|
checkTokenInSession(token)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if equityType == "JD_GOODS":
|
if equityType == "JD_GOODS":
|
||||||
logger.info(f"\t🎉🎉成功获得实物奖励,请尽快前往领取:{activityUrl}")
|
print(f"\t🎉🎉成功获得实物奖励,请尽快前往领取:{activityUrl}")
|
||||||
else:
|
else:
|
||||||
receiveInviteJoinAward(token, awardId)
|
receiveInviteJoinAward(token, awardId)
|
||||||
rewardIndex += 1
|
rewardIndex += 1
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
if i + 1 == len(needInviteNums):
|
if i + 1 == len(needInviteNums):
|
||||||
logger.info("🎉🎉🎉奖励全部领取完毕~")
|
print("🎉🎉🎉奖励全部领取完毕~")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
inviterCode = setMixNick0
|
inviterCode = setMixNick0
|
||||||
@ -482,12 +482,12 @@ if __name__ == '__main__':
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
errorMsg1 = inviteSuccNum
|
errorMsg1 = inviteSuccNum
|
||||||
# logger.info("num != 1", errorMsg1)
|
# print("num != 1", errorMsg1)
|
||||||
if "跳开卡页面" not in errorMsg1:
|
if "跳开卡页面" not in errorMsg1:
|
||||||
if "已成功邀请您加入本店会员" in errorMsg1:
|
if "已成功邀请您加入本店会员" in errorMsg1:
|
||||||
logger.info("⛈已经是会员了,无法完成助力")
|
print("⛈已经是会员了,无法完成助力")
|
||||||
else:
|
else:
|
||||||
logger.info(f"🛳{errorMsg1}")
|
print(f"🛳{errorMsg1}")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
@ -495,16 +495,16 @@ if __name__ == '__main__':
|
|||||||
checkTokenInSession(token)
|
checkTokenInSession(token)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
shopmember(cookie)
|
shopmember(cookie)
|
||||||
logger.info("现在去开卡")
|
print("现在去开卡")
|
||||||
open_result = bindWithVender(cookie)
|
open_result = bindWithVender(cookie)
|
||||||
if open_result is not None:
|
if open_result is not None:
|
||||||
if "火爆" in open_result:
|
if "火爆" in open_result:
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
logger.info("\t尝试重新入会 第1次")
|
print("\t尝试重新入会 第1次")
|
||||||
open_result = bindWithVender(cookie)
|
open_result = bindWithVender(cookie)
|
||||||
if "火爆" in open_result:
|
if "火爆" in open_result:
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
logger.info("\t尝试重新入会 第2次")
|
print("\t尝试重新入会 第2次")
|
||||||
open_result = bindWithVender(cookie)
|
open_result = bindWithVender(cookie)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if num == 1:
|
if num == 1:
|
||||||
@ -513,15 +513,15 @@ if __name__ == '__main__':
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
recordActPvUvdata(token)
|
recordActPvUvdata(token)
|
||||||
checkTokenInSession(token)
|
checkTokenInSession(token)
|
||||||
# logger.info(errorMsg2, '============================')
|
# print(errorMsg2, '============================')
|
||||||
if num == 1 and "开卡失败" in errorMsg2:
|
if num == 1 and "开卡失败" in errorMsg2:
|
||||||
logger.info(f"⚠️车头疑似火爆号,退出本程序!")
|
print(f"⚠️车头疑似火爆号,退出本程序!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if "已成功邀请您加入本店会员" in errorMsg2:
|
if "已成功邀请您加入本店会员" in errorMsg2:
|
||||||
inviteSuccNums += 1
|
inviteSuccNums += 1
|
||||||
logger.info(f"🛳已经邀请{inviteSuccNums}人")
|
print(f"🛳已经邀请{inviteSuccNums}人")
|
||||||
for i, needNum1 in enumerate(needInviteNums):
|
for i, needNum1 in enumerate(needInviteNums):
|
||||||
# logger.info(i, needNum1)
|
# print(i, needNum1)
|
||||||
needNum = needNum1[0]
|
needNum = needNum1[0]
|
||||||
awardId = needNum1[1]
|
awardId = needNum1[1]
|
||||||
equityType = needNum1[2]
|
equityType = needNum1[2]
|
||||||
@ -529,7 +529,7 @@ if __name__ == '__main__':
|
|||||||
if rewardIndex >= i + 1:
|
if rewardIndex >= i + 1:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
logger.info(f"🎉恭喜已完成第{i + 1}档邀请,快去领奖吧!")
|
print(f"🎉恭喜已完成第{i + 1}档邀请,快去领奖吧!")
|
||||||
token = getToken(firstCk, r)
|
token = getToken(firstCk, r)
|
||||||
activityCookie = getActivity(1, 0, inviterCode, 3)
|
activityCookie = getActivity(1, 0, inviterCode, 3)
|
||||||
setMixNick(token)
|
setMixNick(token)
|
||||||
@ -537,13 +537,13 @@ if __name__ == '__main__':
|
|||||||
recordActPvUvdata(token)
|
recordActPvUvdata(token)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
if equityType == "JD_GOODS":
|
if equityType == "JD_GOODS":
|
||||||
logger.info(f"\t🎉🎉成功获得实物奖励,请尽快前往领取:{activityUrl}")
|
print(f"\t🎉🎉成功获得实物奖励,请尽快前往领取:{activityUrl}")
|
||||||
else:
|
else:
|
||||||
receiveInviteJoinAward(token, awardId)
|
receiveInviteJoinAward(token, awardId)
|
||||||
rewardIndex += 1
|
rewardIndex += 1
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
if i + 1 == len(needInviteNums):
|
if i + 1 == len(needInviteNums):
|
||||||
logger.info("🎉🎉🎉奖励全部领取完毕~")
|
print("🎉🎉🎉奖励全部领取完毕~")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if num == 1:
|
if num == 1:
|
||||||
inviterCode = setMixNick0
|
inviterCode = setMixNick0
|
||||||
|
254
jd_tanwei.js
Normal file
254
jd_tanwei.js
Normal file
File diff suppressed because one or more lines are too long
246
jd_try.js
246
jd_try.js
@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
|
* 2022-07-20 修复获取试用列表风控问题;
|
||||||
* 2022-08-12 修复申请试用风控,更换nolan接口
|
* 2022-08-12 修复申请试用风控,更换nolan接口
|
||||||
* 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行
|
* By https://github.com/6dylan6/jdpro/
|
||||||
* 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版
|
* 基于X1a0He版本修改
|
||||||
* 请提前取关至少250个商店确保京东试用脚本正常运行
|
* @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js
|
||||||
|
|
||||||
如需运行请自行添加环境变量:JD_TRY="true" 即可运行
|
|
||||||
脚本是否耗时只看args_xh.maxLength的大小(申请数量),默认50个,申请100个差不多15分钟
|
脚本是否耗时只看args_xh.maxLength的大小(申请数量),默认50个,申请100个差不多15分钟
|
||||||
上一作者说每天申请上限300个(自测,没有申请过上限),关注店铺上限500个
|
上一作者说每天申请上限300个(自测,没有申请过上限),关注店铺上限500个
|
||||||
关注店铺满了就无法继续申请,可用批量取关店铺取消关注
|
关注店铺满了就无法继续申请,可用批量取关店铺取消关注
|
||||||
|
|
||||||
部分环境变量说明,详细请参考58行往下:
|
部分环境变量说明,详细请参考58行往下:
|
||||||
export JD_TRY="true"是否允许,默认false
|
|
||||||
export JD_TRY_PASSZC="false" #不过滤种草官类试用,默认true过滤
|
export JD_TRY_PASSZC="false" #不过滤种草官类试用,默认true过滤
|
||||||
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度,默认50个
|
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度,默认50个
|
||||||
export JD_TRY_PRICE="XX"#商品原价格,大于XX才申请,默认20
|
export JD_TRY_PRICE="XX"#商品原价格,大于XX才申请,默认20
|
||||||
@ -19,13 +18,13 @@ export JD_TRY_APPLYNUMFILTER="10000" #过滤大于设定值的已申请人数
|
|||||||
export JD_TRY_MINSUPPLYNUM="1" #最小提供数量
|
export JD_TRY_MINSUPPLYNUM="1" #最小提供数量
|
||||||
export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知,默认为4
|
export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知,默认为4
|
||||||
export JD_TRY_UNIFIED="false" 默认采用不同试用组
|
export JD_TRY_UNIFIED="false" 默认采用不同试用组
|
||||||
export JD_TRY_NUM="7" 最多跑多少个CK,默认10
|
export JD_TRY_NUM="5" 最多跑多少个CK,默认10
|
||||||
|
|
||||||
cron "1 1 1 1 1" jd_try.js
|
定时自定义,能用多久随缘了!!!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = new Env('京东试用')
|
const $ = new Env('京东试用')
|
||||||
const URL = 'https://api.m.jd.com/client.action'
|
const URL = 'https://api.m.jd.com/client.action'
|
||||||
|
|
||||||
let trialActivityIdList = []
|
let trialActivityIdList = []
|
||||||
let trialActivityTitleList = []
|
let trialActivityTitleList = []
|
||||||
let notifyMsg = ''
|
let notifyMsg = ''
|
||||||
@ -41,18 +40,19 @@ $.getNum = 0;
|
|||||||
$.try = true;
|
$.try = true;
|
||||||
$.sentNum = 0;
|
$.sentNum = 0;
|
||||||
$.cookiesArr = []
|
$.cookiesArr = []
|
||||||
|
//默认的过滤关键词
|
||||||
$.innerKeyWords =
|
$.innerKeyWords =
|
||||||
[
|
[
|
||||||
"幼儿园", "教程", "英语", "辅导", "培训",
|
"幼儿园", "教程", "英语", "辅导", "培训",
|
||||||
"孩子", "小学", "成人用品", "套套", "情趣",
|
"孩子", "小学", "成人用品", "套套", "情趣",
|
||||||
"自慰", "阳具", "飞机杯", "男士用品", "女士用品",
|
"自慰", "阳具", "飞机杯", "男士用品", "女士用品",
|
||||||
"内衣", "高潮", "避孕", "乳腺", "肛塞", "肛门",
|
"内衣", "高潮", "避孕", "乳腺", "肛塞", "肛门",
|
||||||
"宝宝", "玩具", "芭比", "娃娃", "男用",
|
"宝宝", "芭比", "娃娃", "男用",
|
||||||
"女用", "神油", "足力健", "老年", "老人",
|
"女用", "神油", "足力健", "老年", "老人",
|
||||||
"宠物", "饲料", "丝袜", "黑丝", "磨脚",
|
"宠物", "饲料", "丝袜", "黑丝", "磨脚",
|
||||||
"脚皮", "除臭", "性感", "内裤", "跳蛋",
|
"脚皮", "除臭", "性感", "内裤", "跳蛋",
|
||||||
"安全套", "龟头", "阴道", "阴部", "手机卡", "电话卡", "流量卡",
|
"安全套", "龟头", "阴道", "阴部", "手机卡", "电话卡", "流量卡",
|
||||||
"玉坠","和田玉","习题","试卷","手机壳","钢化膜"
|
"习题", "试卷",
|
||||||
]
|
]
|
||||||
//下面很重要,遇到问题请把下面注释看一遍再来问
|
//下面很重要,遇到问题请把下面注释看一遍再来问
|
||||||
let args_xh = {
|
let args_xh = {
|
||||||
@ -187,113 +187,114 @@ let args_xh = {
|
|||||||
!(async () => {
|
!(async () => {
|
||||||
await $.wait(500)
|
await $.wait(500)
|
||||||
// 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true
|
// 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true
|
||||||
if (1) {
|
if (process.env.JD_TRY && process.env.JD_TRY === 'true') {
|
||||||
await requireConfig()
|
$.log('\n遇到问题请先看脚本内注释;解决不了可联系https://t.me/dylan_jdpro\n');
|
||||||
if (!$.cookiesArr[0]) {
|
await requireConfig()
|
||||||
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
|
if (!$.cookiesArr[0]) {
|
||||||
"open-url": "https://bean.m.jd.com/"
|
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
|
||||||
})
|
"open-url": "https://bean.m.jd.com/"
|
||||||
return
|
})
|
||||||
}
|
return
|
||||||
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
|
}
|
||||||
for (let i = 0; i < args_xh.try_num; i++) {
|
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
|
||||||
if ($.cookiesArr[i]) {
|
for (let i = 0; i < args_xh.try_num; i++) {
|
||||||
$.cookie = $.cookiesArr[i];
|
if ($.cookiesArr[i]) {
|
||||||
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
|
$.cookie = $.cookiesArr[i];
|
||||||
$.index = i + 1;
|
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
|
||||||
$.isLogin = true;
|
$.index = i + 1;
|
||||||
$.nickName = '';
|
$.isLogin = true;
|
||||||
//await totalBean();
|
$.nickName = '';
|
||||||
console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
|
await totalBean();
|
||||||
$.except = false;
|
console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
|
||||||
if(args_xh.except.includes($.UserName)){
|
$.except = false;
|
||||||
console.log(`跳过账号:${$.nickName || $.UserName}`)
|
if (args_xh.except.includes($.UserName)) {
|
||||||
$.except = true;
|
console.log(`跳过账号:${$.nickName || $.UserName}`)
|
||||||
continue
|
$.except = true;
|
||||||
}
|
continue
|
||||||
if(!$.isLogin){
|
}
|
||||||
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
|
if (!$.isLogin) {
|
||||||
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
|
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
|
||||||
});
|
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
|
||||||
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
});
|
||||||
continue
|
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||||
}
|
continue
|
||||||
$.totalTry = 0
|
}
|
||||||
$.totalSuccess = 0
|
$.totalTry = 0
|
||||||
$.nowTabIdIndex = 0;
|
$.totalSuccess = 0
|
||||||
$.nowPage = 1;
|
$.nowTabIdIndex = 0;
|
||||||
$.nowItem = 1;
|
$.nowPage = 1;
|
||||||
$.retrynum = 0
|
$.nowItem = 1;
|
||||||
$.jda='__jda='+_jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
|
$.retrynum = 0
|
||||||
if (!args_xh.unified) {
|
$.jda = '__jda=' + _jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
|
||||||
trialActivityIdList = []
|
if (!args_xh.unified) {
|
||||||
trialActivityTitleList = []
|
trialActivityIdList = []
|
||||||
}
|
trialActivityTitleList = []
|
||||||
$.isLimit = false;
|
}
|
||||||
// 获取tabList的,不知道有哪些的把这里的注释解开跑一遍就行了
|
$.isLimit = false;
|
||||||
//await try_tabList();
|
// 获取tabList的,不知道有哪些的把这里的注释解开跑一遍就行了
|
||||||
// return;
|
//await try_tabList();
|
||||||
$.isForbidden = false
|
// return;
|
||||||
$.wrong = false
|
$.isForbidden = false
|
||||||
size = 1
|
$.wrong = false
|
||||||
|
size = 1
|
||||||
|
|
||||||
while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) {
|
while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) {
|
||||||
if ($.nowTabIdIndex === args_xh.tabId.length) {
|
if ($.nowTabIdIndex === args_xh.tabId.length) {
|
||||||
console.log(`tabId组已遍历完毕,不在获取商品\n`);
|
console.log(`tabId组已遍历完毕,不在获取商品\n`);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
await try_feedsList(args_xh.tabId[$.nowTabIdIndex], $.nowPage) //获取对应tabId的试用页面
|
await try_feedsList(args_xh.tabId[$.nowTabIdIndex], $.nowPage) //获取对应tabId的试用页面
|
||||||
}
|
|
||||||
if (trialActivityIdList.length < args_xh.maxLength) {
|
|
||||||
console.log(`间隔等待中,请等待3秒 \n`)
|
|
||||||
await $.wait(3000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($.isForbidden === false && $.isLimit === false) {
|
if (trialActivityIdList.length < args_xh.maxLength) {
|
||||||
console.log(`稍后将执行试用申请,请等待 2 秒\n`)
|
console.log(`间隔等待中,请等待3秒 \n`)
|
||||||
await $.wait(2000);
|
await $.wait(3000);
|
||||||
for (let i = 0; i < trialActivityIdList.length && $.isLimit === false; i++) {
|
|
||||||
if ($.isLimit) {
|
|
||||||
console.log("试用上限")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if ($.isForbidden) { console.log('403了,跳出'); break }
|
|
||||||
await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
|
|
||||||
//console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`)
|
|
||||||
const waitTime = generateRandomInteger(args_xh.applyInterval, 9000);
|
|
||||||
console.log(`随机等待${waitTime}ms后继续`);
|
|
||||||
await $.wait(waitTime);
|
|
||||||
}
|
|
||||||
console.log("试用申请执行完毕...")
|
|
||||||
// await try_MyTrials(1, 1) //申请中的商品
|
|
||||||
$.giveupNum = 0;
|
|
||||||
$.successNum = 0;
|
|
||||||
$.getNum = 0;
|
|
||||||
$.completeNum = 0;
|
|
||||||
await try_MyTrials(1, 2) //申请成功的商品
|
|
||||||
// await try_MyTrials(1, 3) //申请失败的商品
|
|
||||||
await showMsg()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($.isNode()) {
|
if ($.isForbidden === false && $.isLimit === false) {
|
||||||
if ($.index % args_xh.sendNum === 0) {
|
console.log(`稍后将执行试用申请,请等待 2 秒\n`)
|
||||||
$.sentNum++;
|
await $.wait(2000);
|
||||||
console.log(`正在进行第 ${$.sentNum} 次发送通知,发送数量:${args_xh.sendNum}`)
|
for (let i = 0; i < trialActivityIdList.length && $.isLimit === false; i++) {
|
||||||
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
|
if ($.isLimit) {
|
||||||
notifyMsg = "";
|
console.log("试用上限")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if ($.isForbidden) { console.log('403了,跳出'); break }
|
||||||
|
await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
|
||||||
|
//console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`)
|
||||||
|
const waitTime = generateRandomInteger(args_xh.applyInterval, 9000);
|
||||||
|
console.log(`随机等待${waitTime}ms后继续`);
|
||||||
|
await $.wait(waitTime);
|
||||||
}
|
}
|
||||||
|
console.log("试用申请执行完毕...")
|
||||||
|
// await try_MyTrials(1, 1) //申请中的商品
|
||||||
|
$.giveupNum = 0;
|
||||||
|
$.successNum = 0;
|
||||||
|
$.getNum = 0;
|
||||||
|
$.completeNum = 0;
|
||||||
|
await try_MyTrials(1, 2) //申请成功的商品
|
||||||
|
// await try_MyTrials(1, 3) //申请失败的商品
|
||||||
|
await showMsg()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($.isNode() && $.except === false) {
|
if ($.isNode()) {
|
||||||
if (($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum && notifyMsg.length != 0) {
|
if ($.index % args_xh.sendNum === 0) {
|
||||||
console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`)
|
$.sentNum++;
|
||||||
|
console.log(`正在进行第 ${$.sentNum} 次发送通知,发送数量:${args_xh.sendNum}`)
|
||||||
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
|
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
|
||||||
notifyMsg = "";
|
notifyMsg = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log(`\n您未设置变量export JD_TRY="true"运行【京东试用】脚本, 结束运行!\n`)
|
|
||||||
}
|
}
|
||||||
|
if ($.isNode() && $.except === false) {
|
||||||
|
if (($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum && notifyMsg.length != 0) {
|
||||||
|
console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`)
|
||||||
|
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
|
||||||
|
notifyMsg = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`\n您未设置变量export JD_TRY="true"运行【京东试用】脚本, 结束运行!\n`)
|
||||||
|
}
|
||||||
})().catch((e) => {
|
})().catch((e) => {
|
||||||
console.error(`❗️ ${$.name} 运行错误!\n${e}`)
|
console.error(`❗️ ${$.name} 运行错误!\n${e}`)
|
||||||
}).finally(() => $.done())
|
}).finally(() => $.done())
|
||||||
@ -509,19 +510,19 @@ function try_apply(title, activityId) {
|
|||||||
body = await geth5st(body);
|
body = await geth5st(body);
|
||||||
if(!body) return;
|
if(!body) return;
|
||||||
let opt =
|
let opt =
|
||||||
{
|
{
|
||||||
"url": `${URL}?${body}}`,
|
"url": `${URL}?${body}}`,
|
||||||
'headers': {
|
'headers': {
|
||||||
'Cookie': $.cookie + $.jda,
|
'Cookie': $.cookie + $.jda,
|
||||||
'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
'Referer': 'https://prodev.m.jd.com/',
|
'Referer': 'https://prodev.m.jd.com/',
|
||||||
'origin': 'https://prodev.m.jd.com/',
|
'origin': 'https://prodev.m.jd.com/',
|
||||||
'Accept': 'application/json,text/plain,*/*',
|
'Accept': 'application/json,text/plain,*/*',
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
'Accept-Language': 'zh-cn',
|
'Accept-Language': 'zh-cn',
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
$.get(opt, (err, resp, data) => {
|
$.get(opt, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -722,14 +723,15 @@ function geth5st(body) {
|
|||||||
"functionId": "try_apply",
|
"functionId": "try_apply",
|
||||||
"body": body,
|
"body": body,
|
||||||
"appid": "newtry",
|
"appid": "newtry",
|
||||||
"client": "wh5",
|
"client": "wh5",
|
||||||
"clientVersion": "11.0.2",
|
"clientVersion": "11.0.2",
|
||||||
"ua": 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
"ua": 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
"pin": encodeURIComponent($.UserName)
|
"pin": encodeURIComponent($.UserName)
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
},
|
||||||
|
timeout: 30000,
|
||||||
},str='';
|
},str='';
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
$.post(opt, (err, resp, data) => {
|
$.post(opt, (err, resp, data) => {
|
||||||
@ -973,7 +975,7 @@ function Env(name, opts) {
|
|||||||
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
|
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
|
||||||
path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
|
path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
|
||||||
path[path.length - 1]
|
path[path.length - 1]
|
||||||
] = value
|
] = value
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1343,4 +1345,4 @@ function Env(name, opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})(name, opts)
|
})(name, opts)
|
||||||
}
|
}
|
||||||
|
48
utils/jdCookie.py
Normal file
48
utils/jdCookie.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Time : 2022/7/6 23:00
|
||||||
|
# @Author : HarbourJ
|
||||||
|
# @TG : https://t.me/HarbourToulu
|
||||||
|
# @File : jdCookie.py
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from functools import partial
|
||||||
|
print = partial(print, flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
def get_cookies():
|
||||||
|
CookieJDs = []
|
||||||
|
if os.environ.get("JD_COOKIE"):
|
||||||
|
print("已获取并使用Env环境 Cookie")
|
||||||
|
if '&' in os.environ["JD_COOKIE"]:
|
||||||
|
CookieJDs = os.environ["JD_COOKIE"].split('&')
|
||||||
|
elif '\n' in os.environ["JD_COOKIE"]:
|
||||||
|
CookieJDs = os.environ["JD_COOKIE"].split('\n')
|
||||||
|
else:
|
||||||
|
CookieJDs = [os.environ["JD_COOKIE"]]
|
||||||
|
# return CookieJDs
|
||||||
|
else:
|
||||||
|
if os.path.exists("JD_COOKIE.txt"):
|
||||||
|
with open("JD_COOKIE.txt", 'r') as f:
|
||||||
|
JD_COOKIEs = f.read().strip()
|
||||||
|
if JD_COOKIEs:
|
||||||
|
if '&' in JD_COOKIEs:
|
||||||
|
CookieJDs = JD_COOKIEs.split('&')
|
||||||
|
elif '\n' in JD_COOKIEs:
|
||||||
|
CookieJDs = JD_COOKIEs.split('\n')
|
||||||
|
else:
|
||||||
|
CookieJDs = [JD_COOKIEs]
|
||||||
|
CookieJDs = sorted(set(CookieJDs), key=CookieJDs.index)
|
||||||
|
# return CookieJDs
|
||||||
|
else:
|
||||||
|
print("未获取到正确✅格式的京东账号Cookie")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"====================共{len(CookieJDs)}个京东账号Cookie=========\n")
|
||||||
|
print(f"==================脚本执行- 北京时间(UTC+8):{time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}=====================\n")
|
||||||
|
return CookieJDs
|
||||||
|
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
# get_cookies()
|
||||||
|
# print(os.environ.get("JD_COOKIE"))
|
Loading…
Reference in New Issue
Block a user