mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 10:58:44 +08:00
update
This commit is contained in:
parent
0a1320b10f
commit
ba08b80371
File diff suppressed because one or more lines are too long
99
jd_doTreasureRank.py
Normal file
99
jd_doTreasureRank.py
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
File: jd_doTreasureRank.py(京东宝藏榜)
|
||||||
|
Author: HarbourJ
|
||||||
|
Date: 2022/9/19 22:00
|
||||||
|
TG: https://t.me/HarbourToulu
|
||||||
|
TgChat: https://t.me/HarbourSailing
|
||||||
|
cron: 30 0 0 * * *
|
||||||
|
new Env('京东宝藏榜');
|
||||||
|
ActivityEntry: 首页排行榜-宝藏榜
|
||||||
|
"""
|
||||||
|
|
||||||
|
import requests, sys, os, re, time
|
||||||
|
from datetime import datetime
|
||||||
|
from urllib.parse import quote_plus, unquote_plus
|
||||||
|
from functools import partial
|
||||||
|
print = partial(print, flush=True)
|
||||||
|
import warnings
|
||||||
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from jd_sign import *
|
||||||
|
except ImportError as e:
|
||||||
|
print(e)
|
||||||
|
if "No module" in str(e):
|
||||||
|
print("请先运行HarbourJ库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
||||||
|
try:
|
||||||
|
from jdCookie import get_cookies
|
||||||
|
getCk = get_cookies()
|
||||||
|
except:
|
||||||
|
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||||
|
sys.exit(3)
|
||||||
|
|
||||||
|
def randomString(e, flag=False):
|
||||||
|
t = "0123456789abcdef"
|
||||||
|
if flag: t = t.upper()
|
||||||
|
n = [random.choice(t) for _ in range(e)]
|
||||||
|
return ''.join(n)
|
||||||
|
|
||||||
|
def doTask(cookie):
|
||||||
|
url = "https://api.m.jd.com/client.action"
|
||||||
|
payload = f'functionId=doTreasureInteractive&body=%7B%22type%22%3A%223%22%2C%22itemId%22%3A%22%22%7D&appid=newrank_action&clientVersion=11.2.2&client=wh5&ext=%7B%22prstate%22%3A%220%22%7D'
|
||||||
|
headers = {
|
||||||
|
'Host': 'api.m.jd.com',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Origin': 'https://h5.m.jd.com',
|
||||||
|
'User-Agent': ua,
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://h5.m.jd.com/',
|
||||||
|
'request-from': 'native',
|
||||||
|
'Cookie': cookie
|
||||||
|
}
|
||||||
|
response = requests.request("POST", url, headers=headers, data=payload)
|
||||||
|
try:
|
||||||
|
res = response.json()
|
||||||
|
if res['isSuccess']:
|
||||||
|
result = res['result']
|
||||||
|
if result['rewardType'] == 20001:
|
||||||
|
print(f"🎉{result['rewardTitle']} {result['discount']}")
|
||||||
|
else:
|
||||||
|
print("已经领过了,明天再来")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(res)
|
||||||
|
except:
|
||||||
|
print(response.text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
cks = getCk
|
||||||
|
if not cks:
|
||||||
|
sys.exit()
|
||||||
|
except:
|
||||||
|
print("未获取到有效COOKIE,退出程序!")
|
||||||
|
sys.exit()
|
||||||
|
num = 0
|
||||||
|
for cookie in cks[:]:
|
||||||
|
num += 1
|
||||||
|
global ua
|
||||||
|
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())
|
||||||
|
doTask(cookie)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -182,6 +182,9 @@ def getActivity():
|
|||||||
if "活动已结束" in res:
|
if "活动已结束" in res:
|
||||||
print("⛈活动已结束,下次早点来~")
|
print("⛈活动已结束,下次早点来~")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
if "活动未开始" in res:
|
||||||
|
print("⛈活动未开始~")
|
||||||
|
sys.exit()
|
||||||
if "关注" in res and "加购" not in res:
|
if "关注" in res and "加购" not in res:
|
||||||
activityType = 5
|
activityType = 5
|
||||||
else:
|
else:
|
||||||
@ -515,7 +518,7 @@ def getPrize(pin):
|
|||||||
print(f"⛈{errorMessage}")
|
print(f"⛈{errorMessage}")
|
||||||
if "不足" in errorMessage:
|
if "不足" in errorMessage:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
return res['errorMessage']
|
return errorMessage
|
||||||
else:
|
else:
|
||||||
print(f"⛈{res['errorMessage']}")
|
print(f"⛈{res['errorMessage']}")
|
||||||
if '奖品已发完' in res['errorMessage']:
|
if '奖品已发完' in res['errorMessage']:
|
||||||
@ -582,17 +585,17 @@ if __name__ == '__main__':
|
|||||||
drawOk = actCont[5]
|
drawOk = actCont[5]
|
||||||
priceName = actCont[6]
|
priceName = actCont[6]
|
||||||
oneKeyAddCart = actCont[7]
|
oneKeyAddCart = actCont[7]
|
||||||
if needCollectionSize <= hasCollectionSize:
|
|
||||||
print("☃️已完成过加购任务,无法重复进行!")
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
skuIds = [covo['skuId'] for covo in cpvos if not covo['collection']]
|
|
||||||
time.sleep(0.35)
|
time.sleep(0.35)
|
||||||
shopName = shopInfo()
|
shopName = shopInfo()
|
||||||
if num == 1:
|
if num == 1:
|
||||||
print(f"✅开启{shopName}-加购活动,需关注加购{needCollectionSize}个商品")
|
print(f"✅开启{shopName}-加购活动,需关注加购{needCollectionSize}个商品")
|
||||||
print(f"🎁奖品{priceName}\n")
|
print(f"🎁奖品{priceName}\n")
|
||||||
msg += f'✅开启{shopName}-加购活动\n📝活动地址{activityUrl}\n🎁奖品{priceName}\n\n'
|
msg += f'✅开启{shopName}-加购活动\n📝活动地址{activityUrl}\n🎁奖品{priceName}\n\n'
|
||||||
|
if needCollectionSize <= hasCollectionSize:
|
||||||
|
print("☃️已完成过加购任务,无法重复进行!")
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
skuIds = [covo['skuId'] for covo in cpvos if not covo['collection']]
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
getInfo()
|
getInfo()
|
||||||
if needFollow:
|
if needFollow:
|
||||||
@ -607,6 +610,8 @@ if __name__ == '__main__':
|
|||||||
if hasAddCartSize:
|
if hasAddCartSize:
|
||||||
if hasAddCartSize == addSkuNums:
|
if hasAddCartSize == addSkuNums:
|
||||||
print(f"🛳成功一键加购{hasAddCartSize}个商品")
|
print(f"🛳成功一键加购{hasAddCartSize}个商品")
|
||||||
|
else:
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
for productId in skuIds:
|
for productId in skuIds:
|
||||||
if activityType == 6:
|
if activityType == 6:
|
||||||
@ -626,13 +631,16 @@ if __name__ == '__main__':
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
if "擦肩" not in priceName:
|
if "京豆" in priceName:
|
||||||
print(f"🎉获得{priceName}")
|
print(f"🎉获得{priceName}")
|
||||||
msg += f'【账号{num}】{pt_pin}\n🎉{priceName}\n\n'
|
msg += f'【账号{num}】{pt_pin} 🎉{priceName}\n'
|
||||||
else:
|
elif "擦肩" in priceName:
|
||||||
print(f"😭获得💨💨💨")
|
print(f"😭获得💨💨💨")
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
|
|
||||||
title = "🗣消息提醒:加购有礼-JK"
|
title = "🗣消息提醒:加购有礼-JK"
|
||||||
|
msg = f"⏰{str(datetime.now())[:19]}\n" + msg
|
||||||
send(title, msg)
|
send(title, msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user