mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-05-07 03:48:44 +08:00
update
This commit is contained in:
parent
1dff31b2a3
commit
6adec80616
@ -29,6 +29,7 @@ except ImportError as e:
|
|||||||
print(e)
|
print(e)
|
||||||
if "No module" in str(e):
|
if "No module" in str(e):
|
||||||
print("请先运行Faker库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
print("请先运行Faker库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
||||||
|
sys.exit()
|
||||||
try:
|
try:
|
||||||
from jdCookie import get_cookies
|
from jdCookie import get_cookies
|
||||||
getCk = get_cookies()
|
getCk = get_cookies()
|
||||||
@ -77,47 +78,18 @@ def redis_conn():
|
|||||||
def getToken(ck, r=None):
|
def getToken(ck, r=None):
|
||||||
host = f'{activityUrl.split("com/")[0]}com'
|
host = f'{activityUrl.split("com/")[0]}com'
|
||||||
try:
|
try:
|
||||||
# redis缓存Token 活动域名+pt_pin
|
|
||||||
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
||||||
except:
|
except:
|
||||||
# redis缓存Token 活动域名+ck前7位(获取pin失败)
|
|
||||||
pt_pin = ck[:15]
|
pt_pin = ck[:15]
|
||||||
try:
|
try:
|
||||||
if r is not None:
|
try:
|
||||||
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
||||||
# print("Token过期时间", r.ttl(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}'))
|
except Exception as e:
|
||||||
if Token is not None:
|
# print(f"redis get error: {str(e)}")
|
||||||
print(f"♻️获取缓存Token")
|
Token = None
|
||||||
return Token
|
if Token is not None:
|
||||||
else:
|
print(f"♻️获取缓存Token")
|
||||||
# print("🈳去设置Token缓存")
|
return Token
|
||||||
s.headers = {
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
||||||
'User-Agent': '',
|
|
||||||
'Cookie': ck,
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Referer': '',
|
|
||||||
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
|
||||||
'Accept': '*/*'
|
|
||||||
}
|
|
||||||
sign_txt = sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
|
||||||
# print(sign_txt)
|
|
||||||
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
|
||||||
if f.status_code != 200:
|
|
||||||
print(f.status_code)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
if "参数异常" in f.text:
|
|
||||||
return
|
|
||||||
Token_new = f.json()['token']
|
|
||||||
# print(f"Token->: {Token_new}")
|
|
||||||
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
|
||||||
print("✅Token缓存成功")
|
|
||||||
else:
|
|
||||||
print("❌Token缓存失败")
|
|
||||||
return Token_new
|
|
||||||
else:
|
else:
|
||||||
s.headers = {
|
s.headers = {
|
||||||
'Connection': 'keep-alive',
|
'Connection': 'keep-alive',
|
||||||
@ -130,19 +102,27 @@ def getToken(ck, r=None):
|
|||||||
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
||||||
'Accept': '*/*'
|
'Accept': '*/*'
|
||||||
}
|
}
|
||||||
sign_txt = sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
||||||
# 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:
|
||||||
print(f.status_code)
|
print(f.status_code)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if "参数异常" in f.text:
|
if "参数异常" in f.text:
|
||||||
|
print(f.text)
|
||||||
return
|
return
|
||||||
Token = f.json()['token']
|
Token_new = f.json()['token']
|
||||||
print(f"✅获取实时Token")
|
try:
|
||||||
return Token
|
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
||||||
except:
|
print("✅Token缓存成功")
|
||||||
|
else:
|
||||||
|
print("❌Token缓存失败")
|
||||||
|
except Exception as e:
|
||||||
|
# print(f"redis set error: {str(e)}")
|
||||||
|
print(f"✅获取实时Token")
|
||||||
|
return Token_new
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Get Token Error: {str(e)}")
|
||||||
return
|
return
|
||||||
|
|
||||||
def getJdTime():
|
def getJdTime():
|
||||||
@ -512,8 +492,6 @@ def bindWithVender(cookie, venderId):
|
|||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def getShopOpenCardInfo(cookie, venderId):
|
def getShopOpenCardInfo(cookie, venderId):
|
||||||
shopcard_url0 = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/7854908?activityId={activityId}&shareUuid={shareUuid}"
|
|
||||||
shopcard_url = f"https://shopmember.m.jd.com/shopcard/?venderId={venderId}&channel=401&returnUrl={quote_plus(shopcard_url0)}"
|
|
||||||
try:
|
try:
|
||||||
body = {"venderId": str(venderId), "channel": "401"}
|
body = {"venderId": str(venderId), "channel": "401"}
|
||||||
url = f'https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=getShopOpenCardInfo&body={json.dumps(body)}&client=H5&clientVersion=9.2.0&uuid=88888'
|
url = f'https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=getShopOpenCardInfo&body={json.dumps(body)}&client=H5&clientVersion=9.2.0&uuid=88888'
|
||||||
@ -524,7 +502,7 @@ def getShopOpenCardInfo(cookie, venderId):
|
|||||||
'Cookie': cookie,
|
'Cookie': cookie,
|
||||||
'User-Agent': ua,
|
'User-Agent': ua,
|
||||||
'Accept-Language': 'zh-cn',
|
'Accept-Language': 'zh-cn',
|
||||||
'Referer': shopcard_url,
|
'Referer': 'https://shopmember.m.jd.com/',
|
||||||
'Accept-Encoding': 'gzip, deflate'
|
'Accept-Encoding': 'gzip, deflate'
|
||||||
}
|
}
|
||||||
response = requests.get(url=url, headers=headers, timeout=5).text
|
response = requests.get(url=url, headers=headers, timeout=5).text
|
||||||
@ -569,7 +547,8 @@ if __name__ == '__main__':
|
|||||||
pt_pin = re.compile(r'pt_pin=(.*?);').findall(cookie)[0]
|
pt_pin = re.compile(r'pt_pin=(.*?);').findall(cookie)[0]
|
||||||
pt_pin = unquote_plus(pt_pin)
|
pt_pin = unquote_plus(pt_pin)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pt_pin = f'用户{num}'
|
pt_pin = re.compile(r'pin=(.*?);').findall(cookie)[0]
|
||||||
|
pt_pin = unquote_plus(pt_pin)
|
||||||
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||||
print(datetime.now())
|
print(datetime.now())
|
||||||
|
|
||||||
@ -639,9 +618,7 @@ if __name__ == '__main__':
|
|||||||
if openAll0:
|
if openAll0:
|
||||||
print("已完成全部开卡任务")
|
print("已完成全部开卡任务")
|
||||||
if assistState0 == 0:
|
if assistState0 == 0:
|
||||||
print("已经助力过你~")
|
print("无法助力自己~")
|
||||||
# elif assistState0 == 0:
|
|
||||||
# print("无法助力自己~")
|
|
||||||
elif assistState0 == 3:
|
elif assistState0 == 3:
|
||||||
print("已助力过其他好友~")
|
print("已助力过其他好友~")
|
||||||
elif assistState0 == 1:
|
elif assistState0 == 1:
|
||||||
@ -663,19 +640,7 @@ if __name__ == '__main__':
|
|||||||
getShopOpenCardInfo(cookie, venderId)
|
getShopOpenCardInfo(cookie, venderId)
|
||||||
open_result = bindWithVender(cookie, venderId)
|
open_result = bindWithVender(cookie, venderId)
|
||||||
if open_result is not None:
|
if open_result is not None:
|
||||||
if "火爆" in open_result or "失败" in open_result:
|
if "火爆" in open_result or "失败" in open_result or "解绑" in open_result:
|
||||||
time.sleep(1.5)
|
|
||||||
print("\t尝试重新入会 第1次")
|
|
||||||
open_result = bindWithVender(cookie, venderId)
|
|
||||||
if "火爆" in open_result or "失败" in open_result:
|
|
||||||
time.sleep(2)
|
|
||||||
print("\t尝试重新入会 第2次")
|
|
||||||
open_result = bindWithVender(cookie, venderId)
|
|
||||||
if "火爆" in open_result or "失败" in open_result:
|
|
||||||
time.sleep(3)
|
|
||||||
print("\t尝试重新入会 第3次")
|
|
||||||
open_result = bindWithVender(cookie, venderId)
|
|
||||||
if "火爆" in open_result or "失败" in open_result:
|
|
||||||
print(f"\t⛈⛈{venderCardName} {open_result}")
|
print(f"\t⛈⛈{venderCardName} {open_result}")
|
||||||
assStat = False
|
assStat = False
|
||||||
break
|
break
|
||||||
@ -692,12 +657,17 @@ if __name__ == '__main__':
|
|||||||
assistState1 = ass1['assistState']
|
assistState1 = ass1['assistState']
|
||||||
if assStat and assistState1 == 1:
|
if assStat and assistState1 == 1:
|
||||||
print("🎉🎉🎉助力成功~")
|
print("🎉🎉🎉助力成功~")
|
||||||
inviteSuccNum += 1
|
if num != 1:
|
||||||
print(f"本次车头已邀请{inviteSuccNum}人")
|
inviteSuccNum += 1
|
||||||
|
print(f"本次车头已邀请{inviteSuccNum}人")
|
||||||
|
elif assStat and assistState0 == 1:
|
||||||
|
print("🎉🎉🎉助力成功~")
|
||||||
|
if num != 1:
|
||||||
|
inviteSuccNum += 1
|
||||||
|
print(f"本次车头已邀请{inviteSuccNum}人")
|
||||||
|
|
||||||
if num == 1:
|
if num == 1:
|
||||||
print(f"后面账号全部助力 {actorUuid}")
|
print(f"后面账号全部助力 {actorUuid}")
|
||||||
if num == 1:
|
|
||||||
shareUuid = actorUuid
|
shareUuid = actorUuid
|
||||||
activityUrl = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/5929859?activityId={activityId}&shareUuid={shareUuid}&adsource=null&shareuserid4minipg=null&lng=00.000000&lat=00.000000&sid=&un_area=&&shopid={shopId}"
|
activityUrl = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/5929859?activityId={activityId}&shareUuid={shareUuid}&adsource=null&shareuserid4minipg=null&lng=00.000000&lat=00.000000&sid=&un_area=&&shopid={shopId}"
|
||||||
|
|
||||||
|
395
jd_phoneDiscount.py
Normal file
395
jd_phoneDiscount.py
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
File: jd_phoneDiscount.py(手机折上折抽奖)
|
||||||
|
Author: HarbourJ
|
||||||
|
Date: 2022/12/29 20:00
|
||||||
|
TG: https://t.me/HarbourToulu
|
||||||
|
cron: 1 1 1 1 1 1
|
||||||
|
new Env('手机折上折抽奖');
|
||||||
|
活动入口: https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id=63ad1171068bd98098&source=test&baseInfo=LM6HIKdH%2Cbrand_two
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
import time, requests, sys, re, os, json, random
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||||
|
from functools import partial
|
||||||
|
print = partial(print, flush=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from jd_sign import *
|
||||||
|
except ImportError as e:
|
||||||
|
print(e)
|
||||||
|
if "No module" in str(e):
|
||||||
|
print("请先运行Faker库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
||||||
|
sys.exit()
|
||||||
|
try:
|
||||||
|
from jdCookie import get_cookies
|
||||||
|
getCk = get_cookies()
|
||||||
|
except:
|
||||||
|
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||||
|
sys.exit(3)
|
||||||
|
|
||||||
|
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||||
|
redis_port = os.environ.get("redis_port") if os.environ.get("redis_port") else "6379"
|
||||||
|
redis_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||||
|
|
||||||
|
activity_url = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id=63ad1171068bd98098&source=test&baseInfo=LM6HIKdH%2Cbrand_two"
|
||||||
|
print(f"【🛳活动入口】{activity_url}")
|
||||||
|
|
||||||
|
def redis_conn():
|
||||||
|
try:
|
||||||
|
import redis
|
||||||
|
try:
|
||||||
|
pool = redis.ConnectionPool(host=redis_url, port=redis_port, decode_responses=True, socket_connect_timeout=5, password=redis_pwd)
|
||||||
|
r = redis.Redis(connection_pool=pool)
|
||||||
|
r.get('conn_test')
|
||||||
|
print('✅redis连接成功')
|
||||||
|
return r
|
||||||
|
except:
|
||||||
|
print("⚠️redis连接异常")
|
||||||
|
except:
|
||||||
|
print("⚠️缺少redis依赖,请运行pip3 install redis")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def getToken(ck, r=None):
|
||||||
|
host = f'{activityUrl.split("com/")[0]}com'
|
||||||
|
try:
|
||||||
|
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
||||||
|
except:
|
||||||
|
pt_pin = ck[:15]
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
||||||
|
except Exception as e:
|
||||||
|
Token = None
|
||||||
|
if Token is not None:
|
||||||
|
print(f"♻️获取缓存Token")
|
||||||
|
return Token
|
||||||
|
else:
|
||||||
|
s.headers = {
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'User-Agent': '',
|
||||||
|
'Cookie': ck,
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Referer': '',
|
||||||
|
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
||||||
|
'Accept': '*/*'
|
||||||
|
}
|
||||||
|
sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
||||||
|
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
||||||
|
if f.status_code != 200:
|
||||||
|
print(f.status_code)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if "参数异常" in f.text:
|
||||||
|
print(f.text)
|
||||||
|
return
|
||||||
|
Token_new = f.json()['token']
|
||||||
|
try:
|
||||||
|
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
||||||
|
print("✅Token缓存成功")
|
||||||
|
else:
|
||||||
|
print("❌Token缓存失败")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"✅获取实时Token")
|
||||||
|
return Token_new
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Token error: {str(e)}")
|
||||||
|
return
|
||||||
|
|
||||||
|
def getJdTime():
|
||||||
|
url = "http://api.m.jd.com/client.action?functionId=queryMaterialProducts&client=wh5"
|
||||||
|
headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Proxy-Connection': 'keep-alive',
|
||||||
|
'Upgrade-Insecure-Requests': '1',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
response = requests.request("GET", url, headers=headers, timeout=2)
|
||||||
|
if response.status_code == 200:
|
||||||
|
res = response.json()
|
||||||
|
jdTime = res['currentTime2']
|
||||||
|
except:
|
||||||
|
jdTime = int(round(time.time() * 1000))
|
||||||
|
return jdTime
|
||||||
|
|
||||||
|
def randomString(e, flag=False):
|
||||||
|
t = "0123456789abcdef"
|
||||||
|
if flag: t = t.upper()
|
||||||
|
n = [random.choice(t) for _ in range(e)]
|
||||||
|
return ''.join(n)
|
||||||
|
|
||||||
|
def refresh_cookies(res):
|
||||||
|
if res.cookies:
|
||||||
|
cookies = res.cookies.get_dict()
|
||||||
|
set_cookie = [(set_cookie + "=" + cookies[set_cookie]) for set_cookie in cookies]
|
||||||
|
global activityCookie
|
||||||
|
activityCookieMid = [i for i in activityCookie.split(';') if i != '']
|
||||||
|
for i in activityCookieMid:
|
||||||
|
for x in set_cookie:
|
||||||
|
if i.split('=')[0] == x.split('=')[0]:
|
||||||
|
if i.split('=')[1] != x.split('=')[1]:
|
||||||
|
activityCookieMid.remove(i)
|
||||||
|
activityCookie = ''.join(
|
||||||
|
sorted([(set_cookie + ";") for set_cookie in list(set(activityCookieMid + set_cookie))]))
|
||||||
|
# print("刷新cookie", activityCookie)
|
||||||
|
|
||||||
|
def getActivity():
|
||||||
|
url = activityUrl
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Cookie': f'IsvToen={token}'
|
||||||
|
}
|
||||||
|
response = requests.request("GET", url, headers=headers)
|
||||||
|
if response.status_code == 200:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
print(response.status_code)
|
||||||
|
print("⚠️疑似ip黑了")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def getAuth():
|
||||||
|
url = f"https://sjtx-dz.isvjcloud.com/auth/jos?token={token}&jd_source=01&source=test&is_share=1"
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'App-Key': 'LM6HIKdH',
|
||||||
|
'brand': 'brand_two',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
response = requests.request("POST", url, headers=headers)
|
||||||
|
res = response.json()
|
||||||
|
if res['status'] == 0:
|
||||||
|
return res['body']['access_token']
|
||||||
|
else:
|
||||||
|
print(f"⚠️{res}")
|
||||||
|
|
||||||
|
def getUserInfo(authToken):
|
||||||
|
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/get_user_info?source=test&is_share=1"
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'App-Key': 'LM6HIKdH',
|
||||||
|
'Authorization': f'Bearer {authToken}',
|
||||||
|
'brand': 'brand_two',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
response = requests.request("GET", url, headers=headers)
|
||||||
|
res = response.json()
|
||||||
|
try:
|
||||||
|
code = res['code']
|
||||||
|
is_acvite_complete = res['is_acvite_complete']
|
||||||
|
return code, is_acvite_complete
|
||||||
|
except:
|
||||||
|
print(res)
|
||||||
|
|
||||||
|
def getFriendList(authToken):
|
||||||
|
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/get_friend_list?source=test&is_share=1"
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'App-Key': 'LM6HIKdH',
|
||||||
|
'Authorization': f'Bearer {authToken}',
|
||||||
|
'brand': 'brand_two',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
response = requests.request("GET", url, headers=headers)
|
||||||
|
res = response.json()
|
||||||
|
# print("getFriendList:", res)
|
||||||
|
try:
|
||||||
|
friendList = res['friend_list']
|
||||||
|
except Exception as e:
|
||||||
|
print(f"getFriendList Error: {str(e)}")
|
||||||
|
friendList = []
|
||||||
|
return friendList
|
||||||
|
|
||||||
|
def inviteFriend(inviter_id, authToken):
|
||||||
|
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/invite_friend?source=test&is_share=1"
|
||||||
|
payload = '{"inviter_id":"' + inviter_id + '","channel":2}'
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'App-Key': 'LM6HIKdH',
|
||||||
|
'Authorization': f'Bearer {authToken}',
|
||||||
|
'brand': 'brand_two',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
|
res = response.json()
|
||||||
|
return res
|
||||||
|
|
||||||
|
def inviteDrawPrize(invite_type, authToken):
|
||||||
|
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/invite_draw_prize?source=test&is_share=1"
|
||||||
|
payload = '{"invite_type":' + invite_type + '}'
|
||||||
|
headers = {
|
||||||
|
'Host': 'sjtx-dz.isvjcloud.com',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'App-Key': 'LM6HIKdH',
|
||||||
|
'Authorization': f'Bearer {authToken}',
|
||||||
|
'brand': 'brand_two',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Referer': activityUrl,
|
||||||
|
'Connection': 'keep-alive'
|
||||||
|
}
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
|
res = response.json()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
r = redis_conn()
|
||||||
|
try:
|
||||||
|
cks = getCk
|
||||||
|
if not cks:
|
||||||
|
sys.exit()
|
||||||
|
except:
|
||||||
|
print("未获取到有效COOKIE,退出程序!")
|
||||||
|
sys.exit()
|
||||||
|
global shareUuid, inviteSuccNum, activityUrl, firstCk
|
||||||
|
inviteSuccNum = 0
|
||||||
|
try:
|
||||||
|
shareUuid = remote_redis(f"sjtx", 1)
|
||||||
|
except:
|
||||||
|
shareUuid = "63ad1171068bd98098"
|
||||||
|
activityUrl = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id={shareUuid}&source=test&baseInfo=LM6HIKdH%2Cbrand_two"
|
||||||
|
|
||||||
|
num = 0
|
||||||
|
for cookie in cks[:]:
|
||||||
|
num += 1
|
||||||
|
if num == 1:
|
||||||
|
firstCk = cookie
|
||||||
|
if num % 6 == 0:
|
||||||
|
print("⏰等待3s,休息一下")
|
||||||
|
time.sleep(3)
|
||||||
|
global ua, activityCookie, token
|
||||||
|
ua = userAgent()
|
||||||
|
try:
|
||||||
|
pt_pin = re.compile(r'pt_pin=(.*?);').findall(cookie)[0]
|
||||||
|
pt_pin = unquote_plus(pt_pin)
|
||||||
|
except IndexError:
|
||||||
|
pt_pin = re.compile(r'pin=(.*?);').findall(cookie)[0]
|
||||||
|
pt_pin = unquote_plus(pt_pin)
|
||||||
|
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||||
|
|
||||||
|
print(datetime.now())
|
||||||
|
token = None
|
||||||
|
token = getToken(cookie, r)
|
||||||
|
if token is None:
|
||||||
|
if num == 1:
|
||||||
|
print(f"⚠️车头获取Token失败,退出本程序!")
|
||||||
|
sys.exit()
|
||||||
|
print(f"⚠️获取Token失败!⏰等待3s")
|
||||||
|
time.sleep(3)
|
||||||
|
continue
|
||||||
|
time.sleep(0.3)
|
||||||
|
getActivity()
|
||||||
|
time.sleep(0.2)
|
||||||
|
authToken = getAuth()
|
||||||
|
if not authToken:
|
||||||
|
if num == 1:
|
||||||
|
sys.exit()
|
||||||
|
else:
|
||||||
|
time.sleep(1.5)
|
||||||
|
continue
|
||||||
|
time.sleep(0.2)
|
||||||
|
userInfo = getUserInfo(authToken)
|
||||||
|
if not userInfo:
|
||||||
|
if num == 1:
|
||||||
|
sys.exit()
|
||||||
|
else:
|
||||||
|
time.sleep(1.5)
|
||||||
|
continue
|
||||||
|
shareUuid1 = userInfo[0]
|
||||||
|
is_acvite_complete = userInfo[1]
|
||||||
|
time.sleep(0.2)
|
||||||
|
if num == 1:
|
||||||
|
inviteSuccNum = len(getFriendList(authToken))
|
||||||
|
print(f"🧑🤝🧑CK1已邀请{inviteSuccNum}人")
|
||||||
|
if inviteSuccNum >= 10:
|
||||||
|
for i in range(2):
|
||||||
|
invite_type = i + 1
|
||||||
|
print(f"开始第{invite_type}次抽奖")
|
||||||
|
drawPrize = inviteDrawPrize(str(invite_type), authToken)
|
||||||
|
if "prize_info" not in drawPrize:
|
||||||
|
print(drawPrize['message'])
|
||||||
|
else:
|
||||||
|
prize_info = f"{drawPrize['prize_info']['user_prize']['prize_name']}{drawPrize['prize_info']['user_prize']['prize_info']['quota']}"
|
||||||
|
print(f"🎁抽奖获得:{prize_info}")
|
||||||
|
sys.exit()
|
||||||
|
time.sleep(0.2)
|
||||||
|
inviteInfo = inviteFriend(shareUuid, authToken)
|
||||||
|
if "prize_info" not in inviteInfo:
|
||||||
|
print(inviteInfo['message'])
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
inviteSuccNum += 1
|
||||||
|
print(f"🎉助力成功!已邀请{inviteSuccNum}人")
|
||||||
|
prize_info = [f"{x['user_prize']['prize_name']}{x['user_prize']['prize_info']['quota']}个" for x in inviteInfo['prize_info']]
|
||||||
|
print(f"🎁获得{','.join(prize_info)}")
|
||||||
|
if inviteSuccNum >= 10:
|
||||||
|
token = getToken(firstCk, r)
|
||||||
|
time.sleep(0.2)
|
||||||
|
getActivity()
|
||||||
|
time.sleep(0.2)
|
||||||
|
authToken0 = getAuth()
|
||||||
|
time.sleep(0.2)
|
||||||
|
getUserInfo(authToken0)
|
||||||
|
time.sleep(0.2)
|
||||||
|
for i in range(2):
|
||||||
|
invite_type = i + 1
|
||||||
|
print(f"开始第{invite_type}次抽奖")
|
||||||
|
drawPrize0 = inviteDrawPrize(str(invite_type), authToken0)
|
||||||
|
if "prize_info" not in drawPrize0:
|
||||||
|
print(drawPrize0['message'])
|
||||||
|
else:
|
||||||
|
prize_info = f"{drawPrize0['prize_info']['user_prize']['prize_name']}{drawPrize0['prize_info']['user_prize']['prize_info']['quota']}"
|
||||||
|
print(f"🎁抽奖获得:{prize_info}")
|
||||||
|
sys.exit()
|
||||||
|
if num == 1:
|
||||||
|
shareUuid = shareUuid1
|
||||||
|
activityUrl = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id={shareUuid}&source=test&baseInfo=LM6HIKdH%2Cbrand_two"
|
||||||
|
print(f"🤖后面的号全部助力: {shareUuid}")
|
||||||
|
|
||||||
|
time.sleep(2)
|
Loading…
Reference in New Issue
Block a user