mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-28 22:08:45 +08:00
update
This commit is contained in:
parent
9c52e11f8e
commit
01a4214c5b
13
jdCookie.py
13
jdCookie.py
@ -7,12 +7,15 @@
|
||||
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
def get_cookies():
|
||||
CookieJDs = []
|
||||
if os.environ.get("JD_COOKIE"):
|
||||
print("已获取并使用Env环境 Cookie")
|
||||
logger.info("已获取并使用Env环境 Cookie")
|
||||
if '&' in os.environ["JD_COOKIE"]:
|
||||
CookieJDs = os.environ["JD_COOKIE"].split('&')
|
||||
elif '\n' in os.environ["JD_COOKIE"]:
|
||||
@ -34,13 +37,13 @@ def get_cookies():
|
||||
CookieJDs = sorted(set(CookieJDs), key=CookieJDs.index)
|
||||
# return CookieJDs
|
||||
else:
|
||||
print("未获取到正确✅格式的京东账号Cookie")
|
||||
logger.info("未获取到正确✅格式的京东账号Cookie")
|
||||
return
|
||||
|
||||
print(f"====================共{len(CookieJDs)}个京东账号Cookie=========\n")
|
||||
print(f"==================脚本执行- 北京时间(UTC+8):{time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}=====================\n")
|
||||
logger.info(f"====================共{len(CookieJDs)}个京东账号Cookie=========\n")
|
||||
logger.info(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"))
|
||||
# logger.info(os.environ.get("JD_COOKIE"))
|
||||
|
23
jd_cjhy_wxKnowledgeActivity.js
Normal file
23
jd_cjhy_wxKnowledgeActivity.js
Normal file
File diff suppressed because one or more lines are too long
40
jd_dpqd.js
40
jd_dpqd.js
@ -49,26 +49,26 @@ if ($.isNode()) {
|
||||
// token = await getRemoteData();
|
||||
// token = token ? token : [];
|
||||
token = [
|
||||
"26CCFF752088E65E2075EC3C1EC7F16E",
|
||||
"53DE598FA62B714B94B07012B19AF9C3",
|
||||
"BDC952E78780604530F13CBCFB89336A",
|
||||
"773D63918C47D32F33DDB2FB78C5820A",
|
||||
"0C4CC6441DD7F155C8A4A1A119DF2880",
|
||||
"DA71409388CE531378225A6BBF96CDFE",
|
||||
"C1CB0B5488CFE4AE325D8E0C1C71DBF7",
|
||||
"72C1EAAC014BAA48176CF4B86DC567B8",
|
||||
"30D17316E31067004ED239DE9F121B0D",
|
||||
"4E4B5F141AADE9638771B6226AD426D0",
|
||||
"9ADA7B25C761104D8921B811E0EB8AEE",
|
||||
"500B9537712BD828EFC8C4D036B9752A",
|
||||
"612AB059DEDF1AE49910BC575AEDF97B",
|
||||
"4854A3FC0F4E9CFD23D48BB36B0F98A9",
|
||||
"1EED9BA54DCBE78B731281127EA76061",
|
||||
"A55381648D62BA21F9A5B4204A301F0B",
|
||||
"C4E40336212694316DF6812BD7DA3E2B",
|
||||
"0F4FD87223EEA285AA010C4B34A128DA",
|
||||
"D173595F46DFDD996EC3504FDE60F7EB",
|
||||
"07676202D4FAEBE3B5191071420ACCB4"
|
||||
"E9848D1775C8B8EF5F70169E1604DEE5",
|
||||
"8229EA0D203883AB8857762E8783D159",
|
||||
"C76ECDE0C3BAF930CFFE2DB7D55F1A2C",
|
||||
"ED130D17BCE3FA96DAD611A2A2ABD170",
|
||||
"8500B16BACB6E88500C0F24A1106EF26",
|
||||
"B8F0FA48DDC739BA4F5AEF821BFE9121",
|
||||
"BAC43CC0A564B627C34DA11745AE7DC6",
|
||||
"8066A55555BB082F4F8918D439B432C4",
|
||||
"8C45E9DCFBF0086E78627FFDCF0A54E4",
|
||||
"2559F6F396915BF6466A5E482CBEA81D",
|
||||
"B8F0FA48DDC739BA4F5AEF821BFE9121",
|
||||
"3E4ECDF47C7BE3CA16A4BA3B0AA78D5E",
|
||||
"10D78DB822E2A8F13816A601E5729367",
|
||||
"0CCDAE15A9752A480881361DB2198ACD",
|
||||
"75E907EE0108AA1658692B8180C6CB02",
|
||||
"8500B16BACB6E88500C0F24A1106EF26",
|
||||
"A91FA0869F8D6DC14D824F85176BFAC0",
|
||||
"C76ECDE0C3BAF930CFFE2DB7D55F1A2C",
|
||||
"E9848D1775C8B8EF5F70169E1604DEE5",
|
||||
"ED130D17BCE3FA96DAD611A2A2ABD170"
|
||||
];
|
||||
|
||||
token = dpqd_token ? tokens : token;
|
||||
|
@ -26,13 +26,12 @@ except:
|
||||
print = partial(print, flush=True)
|
||||
activatyname = '邀请赢大礼'
|
||||
activityId = 'dVF7gQUVKyUcuSsVhuya5d2XD4F' # 活动类型
|
||||
try:
|
||||
if os.environ.get("jd_inv_authorCode"):
|
||||
authorCode = os.environ["jd_inv_authorCode"] # 活动id
|
||||
else:
|
||||
authorCode = "6b84e047a9154d909febd19d3120aad2"
|
||||
except:
|
||||
print("未在环境变量中获取到有效jd_inv_authorCode变量,请添加变量后重试!")
|
||||
|
||||
authorCode = os.environ.get("jd_inv_authorCode") if os.environ.get("jd_inv_authorCode") else ""
|
||||
|
||||
if not authorCode:
|
||||
print("⚠️未发现有效活动变量jd_inv_authorCode,退出程序!")
|
||||
sys.exit()
|
||||
|
||||
# 随机ua
|
||||
def randomuserAgent():
|
||||
|
@ -34,28 +34,11 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
logger.info("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
logger.info("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
try:
|
||||
if os.environ.get("redis_url"):
|
||||
redis_url = os.environ["redis_url"] # redis ip
|
||||
else:
|
||||
redis_url = "172.17.0.1"
|
||||
if os.environ.get("redis_pwd"):
|
||||
redis_pwd = os.environ["redis_pwd"] # redis 密码
|
||||
else:
|
||||
redis_pwd = ""
|
||||
except:
|
||||
redis_url = "172.17.0.1"
|
||||
redis_pwd = ""
|
||||
|
||||
try:
|
||||
if os.environ.get("jinggengInviteJoin"):
|
||||
jinggengInviteJoin = os.environ["jinggengInviteJoin"]
|
||||
else:
|
||||
jinggengInviteJoin = "9e8080e0828365a10182868854b40115&1000004385"
|
||||
except:
|
||||
jinggengInviteJoin = "9e80809282a4bdc90182ab254c7e0a12&1000121005"
|
||||
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 ""
|
||||
jinggengInviteJoin = os.environ.get("jinggengInviteJoin") if os.environ.get("jinggengInviteJoin") else ""
|
||||
|
||||
inviterNicks = [
|
||||
"Ny0m1K1tVHIJvt0j4SQ9RbRPXMHHf%2BDrNmMVfT8S5hq3SjYMAACrbEHZQ40J5yPY",
|
||||
|
@ -34,7 +34,7 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||
|
22
jd_lzkj_wxKnowledgeActivity.js
Normal file
22
jd_lzkj_wxKnowledgeActivity.js
Normal file
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
venderId = os.environ.get("jd_shopCollectGiftId") if os.environ.get("jd_shopCollectGiftId") else ""
|
||||
|
@ -34,7 +34,7 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||
|
@ -34,7 +34,7 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||
|
523
jd_wxBirthGifts.py
Normal file
523
jd_wxBirthGifts.py
Normal file
@ -0,0 +1,523 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
File: jd_wxBirthGifts.py(生日礼包)
|
||||
Author: HarbourJ
|
||||
Date: 2022/8/8 19:52
|
||||
TG: https://t.me/HarbourToulu
|
||||
TgChat: https://t.me/HarbourSailing
|
||||
cron: 1 1 1 1 1 1
|
||||
new Env('生日礼包');
|
||||
ActivityEntry: https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/activity?activityId=f3325e3375a14866xxxxxxxxxxxx
|
||||
变量 export jd_wxBirthGiftsId="f3325e3375a14866xxxxxxxxxxxx"
|
||||
"""
|
||||
|
||||
import time
|
||||
import requests
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
from datetime import datetime
|
||||
import json
|
||||
import random
|
||||
from urllib.parse import quote_plus, unquote_plus
|
||||
from functools import partial
|
||||
print = partial(print, flush=True)
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
|
||||
from jd_sign import *
|
||||
try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/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_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||
activityId = os.environ.get("jd_wxBirthGiftsId") if os.environ.get("jd_wxBirthGiftsId") else ""
|
||||
|
||||
if not activityId:
|
||||
print("⚠️未发现有效活动变量,退出程序!")
|
||||
sys.exit()
|
||||
activityUrl = f"https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/activity?activityId={activityId}"
|
||||
print(f"【🛳活动入口】{activityUrl}")
|
||||
|
||||
def redis_conn():
|
||||
try:
|
||||
try:
|
||||
import redis
|
||||
except Exception as e:
|
||||
print(e)
|
||||
if "No module" in str(e):
|
||||
os.system("pip install redis")
|
||||
import redis
|
||||
try:
|
||||
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.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:
|
||||
# redis缓存Token 活动域名+pt_pin
|
||||
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
||||
except:
|
||||
# redis缓存Token 活动域名+ck前7位(获取pin失败)
|
||||
pt_pin = ck[:8]
|
||||
|
||||
if r is not None:
|
||||
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}'))
|
||||
if Token is not None:
|
||||
# print(f"♻️获取缓存Token->: {Token}")
|
||||
print(f"♻️获取缓存Token")
|
||||
return Token
|
||||
else:
|
||||
print("🈳去设置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:
|
||||
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 = f.json()['token']
|
||||
print(f"Token->: {Token}")
|
||||
return Token
|
||||
|
||||
def getJdTime():
|
||||
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))]))
|
||||
|
||||
def getActivity():
|
||||
url = activityUrl
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.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'
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
if response.status_code == 200:
|
||||
if response.cookies:
|
||||
cookies = response.cookies.get_dict()
|
||||
set_cookies = [(set_cookie + "=" + cookies[set_cookie]) for set_cookie in cookies]
|
||||
set_cookie = ''.join(sorted([(set_cookie + ";") for set_cookie in set_cookies]))
|
||||
return set_cookie
|
||||
else:
|
||||
print(response.status_code)
|
||||
print("⚠️疑似ip黑了")
|
||||
sys.exit()
|
||||
|
||||
def getOpenStatus():
|
||||
url = "https://cjhy-isv.isvjcloud.com/assembleConfig/getOpenStatus"
|
||||
payload = f'activityId={activityId}'
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
def getSystemConfig():
|
||||
url = "https://cjhy-isv.isvjcloud.com/wxCommonInfo/getSystemConfig"
|
||||
payload = f'activityId={activityId}&activityType='
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def getSimpleActInfoVo():
|
||||
url = "https://cjhy-isv.isvjcloud.com/customer/getSimpleActInfoVo"
|
||||
payload = f"activityId={activityId}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def getMyPing(venderId):
|
||||
url = "https://cjhy-isv.isvjcloud.com/customer/getMyPing"
|
||||
payload = f"userId={venderId}&token={token}&fromType=APP&riskType=1"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']['nickname'], res['data']['secretPin']
|
||||
else:
|
||||
print(f"⚠️{res['errorMessage']}")
|
||||
|
||||
def getMemberLevel(venderId, pin):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/getMemberLevel"
|
||||
payload = f"venderId={venderId}&pin={quote_plus(pin)}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def getOpenCardInfo(venderId, pin, activityType):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/new/brandCard/common/shopAndBrand/getOpenCardInfo"
|
||||
payload = f"venderId={venderId}&buyerPin={quote_plus(pin)}&activityType={activityType}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def accessLog(venderId, pin, activityType):
|
||||
url = "https://cjhy-isv.isvjcloud.com/common/accessLog"
|
||||
payload = f"venderId={venderId}&code={activityType}&pin={quote_plus(pin)}&activityId={activityId}&pageUrl={quote_plus(activityUrl)}&subType="
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
def activityContent(pin, activityType):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/activityContent"
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}&level={activityType}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToken={token};{activityCookie}'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
endTime = res['data']['endTime']
|
||||
if getJdTime() > endTime:
|
||||
print("⛈活动已结束,下次早点来~")
|
||||
sys.exit()
|
||||
return res['data']
|
||||
else:
|
||||
print(f"⛈{res['errorMessage']}")
|
||||
|
||||
def getInfo():
|
||||
url = f"https://cjhy-isv.isvjcloud.com/miniProgramShareInfo/getInfo?activityId={activityId}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
refresh_cookies(response)
|
||||
|
||||
def getBirthInfo(venderId, pin):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/getBirthInfo"
|
||||
payload = f"venderId={venderId}&pin={quote_plus(pin)}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToken={token};{activityCookie}'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def saveBirthDay(venderId, pin):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/saveBirthDay"
|
||||
payload = f"venderId={venderId}&pin={quote_plus(pin)}&birthDay={str(datetime.now())[:10]}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToken={token};{activityCookie}'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def sendBirthGifts(venderId, pin, level):
|
||||
url = "https://cjhy-isv.isvjcloud.com/mc/wxMcLevelAndBirthGifts/sendBirthGifts"
|
||||
payload = f"venderId={venderId}&pin={quote_plus(pin)}&activityId={activityId}&level={level}"
|
||||
headers = {
|
||||
'Host': 'cjhy-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://cjhy-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToken={token};{activityCookie}'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(f"⛈{res['errorMessage']}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
r = redis_conn()
|
||||
try:
|
||||
cks = getCk
|
||||
if not cks:
|
||||
sys.exit()
|
||||
except:
|
||||
print("未获取到有效COOKIE,退出程序!")
|
||||
sys.exit()
|
||||
num = 0
|
||||
for cookie in cks[:]:
|
||||
num += 1
|
||||
if num % 9 == 0:
|
||||
print("⏰等待5s,休息一下")
|
||||
time.sleep(5)
|
||||
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 = f'用户{num}'
|
||||
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||
print(datetime.now())
|
||||
token = getToken(cookie, r)
|
||||
if token is None:
|
||||
print(f"⚠️获取Token失败!⏰等待2s")
|
||||
time.sleep(2)
|
||||
continue
|
||||
time.sleep(0.3)
|
||||
activityCookie = getActivity()
|
||||
time.sleep(0.5)
|
||||
getOpenStatus()
|
||||
time.sleep(0.2)
|
||||
getSimAct = getSimpleActInfoVo()
|
||||
venderId = getSimAct['venderId']
|
||||
activityType = getSimAct['activityType']
|
||||
time.sleep(0.5)
|
||||
getPin = getMyPing(venderId)
|
||||
if getPin:
|
||||
nickname = getPin[0]
|
||||
secretPin = getPin[1]
|
||||
time.sleep(0.3)
|
||||
getOC = getOpenCardInfo(venderId, secretPin, activityType)
|
||||
time.sleep(0.2)
|
||||
if getOC['openedCard']:
|
||||
memberLev = getMemberLevel(venderId, secretPin)
|
||||
if memberLev:
|
||||
level = memberLev['level']
|
||||
shopTitle = memberLev['shopTitle']
|
||||
print(f"✅开启{shopTitle} 生日礼包")
|
||||
time.sleep(0.2)
|
||||
accessLog(venderId, secretPin, activityType)
|
||||
time.sleep(0.2)
|
||||
actContent = activityContent(secretPin, activityType)
|
||||
if actContent:
|
||||
if actContent['isReceived'] == 1:
|
||||
print(f"💨{nickname} 今年已经领过了,明年再来吧~")
|
||||
continue
|
||||
else:
|
||||
time.sleep(0.2)
|
||||
getInfo()
|
||||
time.sleep(0.2)
|
||||
try:
|
||||
getBirthInfo(venderId, secretPin)
|
||||
time.sleep(0.2)
|
||||
saveBirthDay(venderId, secretPin)
|
||||
time.sleep(0.2)
|
||||
sendGift = sendBirthGifts(venderId, secretPin, level)
|
||||
birthdayResult = sendGift['birthdayResult']
|
||||
if birthdayResult:
|
||||
birthdayData = sendGift['birthdayData']
|
||||
gifts = [(f"{x['beanNum']}{x['name']}") for x in birthdayData]
|
||||
print(f"🎉🎉🎉{nickname} 成功领取 {','.join(gifts)}")
|
||||
else:
|
||||
print(f"💨{nickname} 生日礼包领取失败,请重试~")
|
||||
except:
|
||||
print(f"💨{nickname} 生日礼包领取失败,请重试~")
|
||||
else:
|
||||
print(f"⛈{nickname} 非店铺会员无法领取生日礼包!")
|
||||
continue
|
||||
time.sleep(2.5)
|
@ -10,6 +10,7 @@ TgChat: https://t.me/HarbourSailing
|
||||
cron: 1 1 1 1 1 1
|
||||
new Env('店铺特效关注有礼');
|
||||
ActivityEntry: https://lzkj-isv.isvjcloud.com/wxShopGift/activity?activityId=971e85d5dfd445e1acfc63bafffb8ecc
|
||||
变量 export jd_wxShopGiftId="971e85d5dfd445e1axxxxxxxxxxxx"
|
||||
"""
|
||||
|
||||
import time
|
||||
@ -31,7 +32,7 @@ try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/shufflewzc/faker2/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_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||
@ -65,44 +66,15 @@ def getToken(ck, r=None):
|
||||
except:
|
||||
# redis缓存Token 活动域名+ck前7位(获取pin失败)
|
||||
pt_pin = ck[:8]
|
||||
try:
|
||||
if r is not None:
|
||||
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}'))
|
||||
if Token is not None:
|
||||
# print(f"♻️获取缓存Token->: {Token}")
|
||||
print(f"♻️获取缓存Token")
|
||||
return Token
|
||||
else:
|
||||
print("🈳去设置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
|
||||
if r is not None:
|
||||
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}'))
|
||||
if Token is not None:
|
||||
# print(f"♻️获取缓存Token->: {Token}")
|
||||
print(f"♻️获取缓存Token")
|
||||
return Token
|
||||
else:
|
||||
print("🈳去设置Token缓存")
|
||||
s.headers = {
|
||||
'Connection': 'keep-alive',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
@ -123,11 +95,37 @@ def getToken(ck, r=None):
|
||||
else:
|
||||
if "参数异常" in f.text:
|
||||
return
|
||||
Token = f.json()['token']
|
||||
print(f"Token->: {Token}")
|
||||
return Token
|
||||
except:
|
||||
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:
|
||||
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 = f.json()['token']
|
||||
print(f"Token->: {Token}")
|
||||
return Token
|
||||
|
||||
def getJdTime():
|
||||
jdTime = int(round(time.time() * 1000))
|
||||
|
File diff suppressed because one or more lines are too long
19
jd_yqhy.py
19
jd_yqhy.py
@ -1,16 +1,16 @@
|
||||
"""
|
||||
# 邀好友赢大礼 create by doubi 通用模板
|
||||
# 邀好友赢大礼 create by doubi 通用模板
|
||||
# 17:/椋东送福利,邀请好友,争排行榜排位,大礼送不停,(E1Y7RAtC4b) ,升级新版猄·=·Dσσōngαpρ
|
||||
# https://prodev.m.jd.com/mall/active/dVF7gQUVKyUcuSsVhuya5d2XD4F/index.html?code=16dde1860f1b4f1b9a93db6612abf0b9&invitePin=pin值
|
||||
# 注意事项 pin 为助力pin 必须保证ck在里面
|
||||
|
||||
|
||||
环境变量说明:
|
||||
export yhypin="需要助力的pin值"
|
||||
export yhypin="需要助力的pin值"
|
||||
export yhyactivityId="活动类型ID"
|
||||
export yhyauthorCode="活动ID"
|
||||
|
||||
cron: 6 6 6 6 *
|
||||
cron: 1 1 1 1 1
|
||||
new Env('邀请赢大礼');
|
||||
"""
|
||||
|
||||
@ -94,7 +94,7 @@ async def plogin(ua,cookie):
|
||||
'Referer': 'https://prodev.m.jd.com/',
|
||||
'User-Agent':ua
|
||||
}
|
||||
response = requests.get(url=url,headers=header,timeout=30).text
|
||||
response = requests.get(url=url,headers=header,timeout=5).text
|
||||
return response
|
||||
|
||||
# 活动接口
|
||||
@ -115,7 +115,7 @@ async def jdjoy(ua,cookie):
|
||||
}
|
||||
response = requests.get(url=url,headers=header).text
|
||||
return json.loads(response)
|
||||
|
||||
|
||||
# go开卡
|
||||
async def ruhui(ua,cookie):
|
||||
url = f'https://jdjoy.jd.com/member/bring/joinMember?code={authorCode}&invitePin={invitePin}'
|
||||
@ -224,6 +224,7 @@ async def main():
|
||||
print(f'==================共{len(cks)}个京东账号Cookie==================')
|
||||
print(f'==================脚本执行- 北京时间(UTC+8):{get_time()}=====================\n')
|
||||
print(f'您好!{invitePin},正在获取您的活动信息',)
|
||||
print(f'活动地址: {activityUrl}')
|
||||
ua = randomuserAgent() # 获取ua
|
||||
result = await check(ua, inveteck) # 检测ck
|
||||
if result['code'] == 200:
|
||||
@ -238,15 +239,15 @@ async def main():
|
||||
successCount = result['data']['successCount'] # 当前成功数
|
||||
success += successCount
|
||||
result_data = result['data']['rewards'] # 奖品数据
|
||||
print(f'您好!账号[{invitePin}],开启{brandName}邀请好友活动\n去开活动')
|
||||
print(f'您好!账号[{invitePin}],开启{brandName}邀请好友活动\n去开活动')
|
||||
for i in result_data:
|
||||
stage = i['stage']
|
||||
inviteNum = i['inviteNum'] # 单次需要拉新人数
|
||||
need.append(inviteNum)
|
||||
need.append(inviteNum)
|
||||
rewardName = i['rewardName'] # 奖品名
|
||||
rewardNum = i['rewardStock']
|
||||
if rewardNum !=0:
|
||||
needinviteNum.append(inviteNum)
|
||||
needinviteNum.append(inviteNum)
|
||||
needdel.append(inviteNum)
|
||||
rewardslist.append(f'级别{stage}: 需助力{inviteNum}人,奖品: {rewardName},库存:{rewardNum}件\n')
|
||||
if len(rewardslist)!=0:
|
||||
@ -285,7 +286,7 @@ async def main():
|
||||
if needinviteNum == []:
|
||||
print('奖励已经全部获取啦,退出程序')
|
||||
return
|
||||
await plogin(ua,ck) # 获取登录状态
|
||||
await plogin(ua,ck) # 获取登录状态
|
||||
result = await check(ua, ck) # 检测ck
|
||||
if result['code'] == 200:
|
||||
result = await jdjoy(ua,ck) # 调用ck
|
||||
|
Loading…
Reference in New Issue
Block a user