KingRan 2022-02-12 10:00:54 +08:00
parent 6008950a29
commit 16a1a4e290
2 changed files with 1362 additions and 0 deletions

999
jd_beauty_plant.py 100644
View File

@ -0,0 +1,999 @@
#!/bin/env python3
# -*- coding: utf-8 -*
'''
感谢Curtin提供的其他脚本供我参考
感谢aburd ch大佬的指导
项目名称:xF_jd_beauty_plant.py
Author: 一风一扬
功能健康社区-种植园自动任务
Date: 2022-1-4
cron: 10 9,11,15,21 * * * jd_beauty_plant.py
new Env('化妆馆-种植园自动任务');
活动入口25:/2EaeU74Gz07gJ%
教程该活动与京东的ck通用所以只需要填写第几个号运行改脚本就行了
青龙变量填写export plant_cookie="1"代表京东CK的第一个号执行该脚本
多账号用&隔开例如export plant_cookie="1&2"代表京东CK的第一二个号执行该脚本这样做JD的ck过期就不用维护两次了所以做出了更新
青龙变量export choose_plant_id="true",表示自己选用浇水的ID适用于种植了多个产品的人默认为false如果是false仅适用于种植了一个产品的人
对于多账号的只要有一个账号种植多个产品都必须为true才能浇水如果choose_plant_id="false"planted_id可以不填写变量值
青龙变量export planted_id = 'xxxx'表示需要浇水的id单账号可以先填写export planted_id = '111111'export choose_plant_id="true"运行一次脚本
日志输出会有planted_id然后再重新修改export planted_id = 'xxxxxx'多个账号也一样如果2个账号export planted_id = '111111&111111'
3个账号export planted_id = '111111&111111&111111'以此类推
注意planted_id和ck位置要对应而且你有多少个账号就得填多少个planted_id首次111111填写时为6位数
例如export plant_cookie="xxxx&xxxx&xxx"那export planted_id = "111111&111111&111111",也要写满3个id这样才能保证所有账号都能跑
'''
######################################################以下代码请不要乱改######################################
UserAgent = ''
account = ''
cookie = ''
cookies = []
choose_plant_id = 'false'
planted_id = ''
shop_id = ''
beauty_plant_exchange = 'false'
planted_ids = []
import requests
import time, datetime
import requests, re, os, sys, random, json
from urllib.parse import quote, unquote
import threading
import urllib3
# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
requests.packages.urllib3.disable_warnings ()
today = datetime.datetime.now ().strftime ('%Y-%m-%d')
tomorrow = (datetime.datetime.now () + datetime.timedelta (days=1)).strftime ('%Y-%m-%d')
nowtime = datetime.datetime.now ().strftime ('%Y-%m-%d %H:%M:%S.%f8')
time1 = '21:00:00.00000000'
time2 = '23:00:00.00000000'
flag_time1 = '{} {}'.format (today, time1)
flag_time2 = '{} {}'.format (today, time2)
pwd = os.path.dirname (os.path.abspath (__file__)) + os.sep
path = pwd + "env.sh"
sid = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 32))
sid_ck = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdefABCDEFGHIJKLMNOPQRSTUVWXYZ', 43))
def printT(s):
print ("[{0}]: {1}".format (datetime.datetime.now ().strftime ("%Y-%m-%d %H:%M:%S"), s))
sys.stdout.flush ()
def getEnvs(label):
try:
if label == 'True' or label == 'yes' or label == 'true' or label == 'Yes':
return True
elif label == 'False' or label == 'no' or label == 'false' or label == 'No':
return False
except:
pass
try:
if '.' in label:
return float (label)
elif '&' in label:
return label.split ('&')
elif '@' in label:
return label.split ('@')
else:
return int (label)
except:
return label
# 获取v4环境 特殊处理
try:
with open (v4f, 'r', encoding='utf-8') as v4f:
v4Env = v4f.read ()
r = re.compile (r'^export\s(.*?)=[\'\"]?([\w\.\-@#&=_,\[\]\{\}\(\)]{1,})+[\'\"]{0,1}$',
re.M | re.S | re.I)
r = r.findall (v4Env)
curenv = locals ()
for i in r:
if i[0] != 'JD_COOKIE':
curenv[i[0]] = getEnvs (i[1])
except:
pass
############# 在pycharm测试ql环境用实际用下面的代码运行 #########
# with open(path, "r+", encoding="utf-8") as f:
# ck = f.read()
# if "JD_COOKIE" in ck:
# r = re.compile (r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I)
# cookies = r.findall (ck)
# # print(cookies)
# # cookies = cookies[0]
# # print(cookies)
# # cookies = cookies.split ('&')
# printT ("已获取并使用ck环境 Cookie")
#######################################################################
if "plant_cookie" in os.environ:
if len (os.environ["plant_cookie"]) == 1:
is_ck = int(os.environ["plant_cookie"])
cookie1 = os.environ["JD_COOKIE"].split('&')
cookie = cookie1[is_ck-1]
printT ("已获取并使用Env环境cookie")
elif len (os.environ["plant_cookie"]) > 1:
cookies1 = []
cookies1 = os.environ["JD_COOKIE"]
cookies1 = cookies1.split ('&')
is_ck = os.environ["plant_cookie"].split('&')
for i in is_ck:
cookies.append(cookies1[int(i)-1])
printT ("已获取并使用Env环境plant_cookies")
else:
printT ("变量plant_cookie未填写")
exit (0)
if "choose_plant_id" in os.environ:
choose_plant_id = os.environ["choose_plant_id"]
printT (f"已获取并使用Env环境choose_plant_id={choose_plant_id}")
else:
printT ("变量choose_plant_id未填写,默认为false只种植了一个如果种植了多个请填写改变量planted_id")
if "planted_id" in os.environ:
if len (os.environ["planted_id"]) > 8:
planted_ids = os.environ["planted_id"]
planted_ids = planted_ids.split ('&')
else:
planted_id = os.environ["planted_id"]
printT (f"已获取并使用Env环境planted_id={planted_id}")
else:
printT ("变量planted_id未填写,默认为false只种植了一个如果种植了多个请填写改变量planted_id")
if "beauty_plant_exchange" in os.environ:
beauty_plant_exchange = os.environ["beauty_plant_exchange"]
printT (f"已获取并使用Env环境beauty_plant_exchange={beauty_plant_exchange}")
else:
printT ("变量beauty_plant_exchange未填写,默认为false不用美妆币兑换肥料")
def userAgent():
"""
随机生成一个UA
:return: jdapp;iPhone;9.4.8;14.3;xxxx;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1
"""
if not UserAgent:
uuid = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 40))
addressid = ''.join (random.sample ('1234567898647', 10))
iosVer = ''.join (
random.sample (["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1))
iosV = iosVer.replace ('.', '_')
iPhone = ''.join (random.sample (["8", "9", "10", "11", "12", "13"], 1))
ADID = ''.join (random.sample ('0987654321ABCDEF', 8)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (random.sample ('0987654321ABCDEF', 12))
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone{iPhone},1;addressid/{addressid};supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1'
else:
return UserAgent
## 获取通知服务
class msg (object):
def __init__(self, m=''):
self.str_msg = m
self.message ()
def message(self):
global msg_info
printT (self.str_msg)
try:
msg_info = "{}\n{}".format (msg_info, self.str_msg)
except:
msg_info = "{}".format (self.str_msg)
sys.stdout.flush () # 这代码的作用就是刷新缓冲区。
# 当我们打印一些字符时并不是调用print函数后就立即打印的。一般会先将字符送到缓冲区然后再打印。
# 这就存在一个问题,如果你想等时间间隔的打印一些字符,但由于缓冲区没满,不会打印。就需要采取一些手段。如每次打印后强行刷新缓冲区。
def getsendNotify(self, a=0):
if a == 0:
a += 1
try:
url = 'https://gitee.com/curtinlv/Public/raw/master/sendNotify.py'
response = requests.get (url)
if 'curtinlv' in response.text:
with open ('sendNotify.py', "w+", encoding="utf-8") as f:
f.write (response.text)
else:
if a < 5:
a += 1
return self.getsendNotify (a)
else:
pass
except:
if a < 5:
a += 1
return self.getsendNotify (a)
else:
pass
def main(self):
global send
cur_path = os.path.abspath (os.path.dirname (__file__))
sys.path.append (cur_path)
if os.path.exists (cur_path + "/sendNotify.py"):
try:
from sendNotify import send
except:
self.getsendNotify ()
try:
from sendNotify import send
except:
printT ("加载通知服务失败~")
else:
self.getsendNotify ()
try:
from sendNotify import send
except:
printT ("加载通知服务失败~")
###################
msg ().main ()
def setName(cookie):
try:
r = re.compile (r"pt_pin=(.*?);") # 指定一个规则查找pt_pin=与;之前的所有字符,但pt_pin=与;不复制。r"" 的作用是去除转义字符.
userName = r.findall (cookie) # 查找pt_pin=与;之前的所有字符并复制给r其中pt_pin=与;不复制。
# print (userName)
userName = unquote (userName[0]) # r.findall(cookie)赋值是list列表这个赋值为字符串
# print(userName)
return userName
except Exception as e:
print (e, "cookie格式有误")
exit (2)
# 获取ck
def get_ck(token, sid_ck, account):
try:
url = 'https://api.m.jd.com/client.action?functionId=isvObfuscator'
headers = {
# 'Connection': 'keep-alive',
'accept': '*/*',
"cookie": f"{token}",
'host': 'api.m.jd.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'user-Agent': "JD4iPhone/167922%20(iPhone;%20iOS;%20Scale/2.00)",
'accept-Encoding': 'gzip, deflate, br',
'accept-Language': 'zh-Hans-CN;q=1',
"content-type": "application/x-www-form-urlencoded",
# "content-length":"1348",
}
timestamp = int (round (time.time () * 1000))
timestamp1 = int (timestamp / 1000)
data = r'body=%7B%22url%22%3A%22https%3A%5C/%5C/xinruismzd-isv.isvjcloud.com%22%2C%22id%22%3A%22%22%7D&build=167922&client=apple&clientVersion=10.3.2&d_brand=apple&d_model=iPhone12%2C1&ef=1&eid=eidI4a9081236as4w7JpXa5zRZuwROIEo3ORpcOyassXhjPBIXtrtbjusqCxeW3E1fOtHUlGhZUCur1Q1iocDze1pQ9jBDGfQs8UXxMCTz02fk0RIHpB&ep=%7B%22ciphertype%22%3A5%2C%22cipher%22%3A%7B%22screen%22%3A%22ENS4AtO3EJS%3D%22%2C%22wifiBssid%22%3A%22' + f"{sid_ck}" + r'%3D%22%2C%22osVersion%22%3A%22CJUkCK%3D%3D%22%2C%22area%22%3A%22CJvpCJY1DV80ENY2XzK%3D%22%2C%22openudid%22%3A%22Ytq3YtKyDzO5CJuyZtu4CWSyZtC0Ytc1CJLsDwC5YwO0YtS5CNrsCK%3D%3D%22%2C%22uuid%22%3A%22aQf1ZRdxb2r4ovZ1EJZhcxYlVNZSZz09%22%7D%2C%22ts%22%3A1642002985%2C%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22version%22%3A%221.0.3%22%2C%22appname%22%3A%22com.360buy.jdmobile%22%2C%22ridx%22%3A-1%7D&ext=%7B%22prstate%22%3A%220%22%2C%22pvcStu%22%3A%221%22%7D&isBackground=N&joycious=88&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&partner=apple&rfs=0000&scope=01&sign=946db60626658b250cf47aafb6f67691&st=1642002999847&sv=112&uemps=0-0&uts=0f31TVRjBSu3kkqwe7t25AkQCKuzV3pz8JrojVuU0630g%2BkZigs9kTwRghT26sE72/e92RRKan/%2B9SRjIJYCLuhew91djUwnIY47k31Rwne/U1fOHHr9FmR31X03JKJjwao/EC1gy4fj7PV1Co0ZOjiCMTscFo/8id2r8pCHYMZcaeH3yPTLq1MyFF3o3nkStM/993MbC9zim7imw8b1Fg%3D%3D'
# data = '{"token":"AAFh3ANjADAPSunyKSzXTA-UDxrs3Tn9hoy92x4sWmVB0Kv9ey-gAMEdJaSDWLWtnMX8lqLujBo","source":"01"}'
# print(data)
response = requests.post (url=url, verify=False, headers=headers, data=data)
result = response.json ()
# print(result)
access_token = result['token']
# print(access_token)
return access_token
except Exception as e:
msg ("账号【{0}】获取ck失败cookie过期".format (account))
# 获取Authorization
def get_Authorization(access_token, account):
try:
url = 'https://xinruimz-isv.isvjcloud.com/papi/auth'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": 'Bearer undefined',
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/logined_jd/',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Origin": "https://xinruimz-isv.isvjcloud.com",
"Content-Type": "application/json;charset=utf-8",
}
data = '{"token":"' + f"{access_token}" + r'","source":"01"}'
# print(data)
response = requests.post (url=url, verify=False, headers=headers, data=data)
result = response.json ()
print (result)
access_token = result['access_token']
access_token = r"Bearer " + access_token
# print(access_token)
return access_token
except Exception as e:
msg ("账号【{0}】获取Authorization失败cookie过期".format (account))
# 获取已种植的信息
def get_planted_info(cookie, sid, account):
name_list = []
planted_id_list = []
position_list = []
shop_id_list = []
url = 'https://xinruimz-isv.isvjcloud.com/papi/get_home_info'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9'
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
planted_list = result['plant_info']
# print(planted_list)
for i in range (len (planted_list)):
try:
name = result['plant_info'][f'{i + 1}']['data']['name']
planted_id = result['plant_info'][f'{i + 1}']['data']['id']
position = result['plant_info'][f'{i + 1}']['data']['position']
shop_id = result['plant_info'][f'{i + 1}']['data']['shop_id']
# print(name,planted_id,position,shop_id)
name_list.append (name)
planted_id_list.append (planted_id)
position_list.append (position)
shop_id_list.append (shop_id)
print (f"账号{account}种植的种子为", name, "planted_id:", planted_id, ",shop_id:", shop_id)
except Exception as e:
pass
return name_list, position_list, shop_id_list, planted_id_list
# 领取每日水滴
def get_water(cookie, position, sid, account):
try:
j = 0
url = 'https://xinruimz-isv.isvjcloud.com/papi/collect_water'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
for i in position:
data = r'{"position":' + f"{i}" + r'}'
response = requests.post (url=url, verify=False, headers=headers, data=data)
# print(response.status_code)
if response.status_code == 204:
j += 1
total = j * 10
if response.status_code == 204:
msg ("账号【{0}】成功领取每日水滴{1}".format (account, total))
except Exception as e:
msg ("账号【{0}】领取每日水滴失败可能是cookie过期".format (account))
# 领取每日肥料
def get_fertilizer(cookie, shop_id, account):
try:
j = 0
url = 'https://xinruimz-isv.isvjcloud.com/papi/collect_fertilizer'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
for i in shop_id:
data = r'{"shop_id":' + f"{i}" + r'}'
response = requests.post (url=url, verify=False, headers=headers, data=data)
if response.status_code == 204:
j += 1
total = j * 10
if response.status_code == 204:
msg ("账号【{0}】成功领取每日肥料{1}".format (account, total))
except Exception as e:
msg ("账号【{0}】领取每日肥料失败可能是cookie过期".format (account))
# 获取任务信息
def get_task(cookie, account):
try:
taskName_list = []
taskId_list = []
taskName_list2 = []
taskId_list2 = []
taskName_list3 = []
taskId_list3 = []
url = 'https://xinruimz-isv.isvjcloud.com/papi/water_task_info'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
task_list = result['shops']
task_list2 = result['meetingplaces']
task_list3 = result['prodcuts'] # 浏览加购
# print(task_list)
for i in range (len (task_list)):
try:
taskName = task_list[i]['name']
taskId = task_list[i]['id']
taskId_list.append (taskId)
taskName_list.append (taskName)
except Exception as e:
print (e)
for i in range (len (task_list2)):
try:
taskName2 = task_list2[i]['name']
taskId2 = task_list2[i]['id']
taskId_list2.append (taskId2)
taskName_list2.append (taskName2)
except Exception as e:
print (e)
for i in range (len (task_list3)):
try:
taskName3 = task_list3[i]['name']
taskId3 = task_list3[i]['id']
taskId_list3.append (taskId3)
taskName_list3.append (taskName3)
except Exception as e:
print (e)
# print(taskName_list,taskId_list,taskName_list2,taskId_list2,taskName_list3,taskId_list3)
return taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3
except Exception as e:
print (e)
message = result['message']
if "非法店铺" in message:
msg ("【账号{0}】种子过期,请重新种植".format (account))
# 获取任务信息
def get_fertilizer_task(cookie, shop_id, account):
try:
# taskName_list = []
# taskId_list = []
taskName_list2 = []
taskId_list2 = []
taskName_list3 = []
taskId_list3 = []
taskName_list4 = []
taskId_list4 = []
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_task_info?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
# task_list = result['shops']
task_list2 = result['meetingplaces']
task_list3 = result['prodcuts'] # 浏览加购
task_list4 = result['live'] # 浏览直播
# print(task_list)
# for i in range (len (task_list)):
# try:
# taskName = task_list[i]['name']
# taskId = task_list[i]['id']
# taskId_list.append(taskId)
# taskName_list.append(taskName)
# except Exception as e:
# print(e)
for i in range (len (task_list2)):
try:
taskName2 = task_list2[i]['name']
taskId2 = task_list2[i]['id']
taskId_list2.append (taskId2)
taskName_list2.append (taskName2)
except Exception as e:
print (e)
for i in range (len (task_list3)):
try:
taskName3 = task_list3[i]['name']
taskId3 = task_list3[i]['id']
taskId_list3.append (taskId3)
taskName_list3.append (taskName3)
except Exception as e:
print (e)
for i in range (len (task_list4)):
try:
taskName4 = task_list4[i]['name']
taskId4 = task_list4[i]['id']
taskId_list4.append (taskId4)
taskName_list4.append (taskName4)
except Exception as e:
print (e)
# print(taskName_list,taskId_list,taskName_list2,taskId_list2,taskName_list3,taskId_list3)
return taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4
except Exception as e:
print (e)
message = result['message']
if "非法店铺" in message:
msg ("【账号{0}】种子过期,请重新种植".format (account))
# 做任务1
def do_task1(cookie, taskName, taskId, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_shop_view?shop_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览任务【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览任务【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 做浏览任务
def do_task2(cookie, taskName, taskId, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_meetingplace_view?meetingplace_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览任务【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览任务【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 浏览加购
def do_task3(cookie, taskName, taskId, sid, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_product_view?product_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览加购【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览加购【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览关注
def do_fertilizer_task(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_shop_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
while True:
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【浏览关注】等待10秒".format (account))
msg ("账号【{0}】执行【浏览关注】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览
def do_fertilizer_task2(cookie, name, meetingplace_id, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_meetingplace_view?meetingplace_id={meetingplace_id}&shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览关注{1}等待10秒".format (account, name))
msg ("账号【{0}】执行浏览关注{1}任务成功,获取【{2}】肥料".format (account, name, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-加购
def do_fertilizer_task3(cookie, name, product_id, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_product_view?product_id={product_id}&shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
while True:
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览并加购{1}等待10秒".format (account, name))
msg ("账号【{0}】执行浏览并加购{1}任务成功,获取【{2}】肥料".format (account, name, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-观看其他小样
def do_fertilizer_task4(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_sample_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【观看其他小样】等待10秒".format (account))
msg ("账号【{0}】执行【观看其他小样】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览化妆馆
def do_fertilizer_task5(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_chanel_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【浏览化妆馆】等待10秒".format (account))
msg ("账号【{0}】执行【浏览化妆馆】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-美妆币兑换每天5次
def do_fertilizer_task6(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_exchange?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
for i in range (5):
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字需要encode为utf-8
result = response.json ()
# print(result)
score = result['inc']
print ("账号【{0}】【shop_id:{1}】正在【兑换肥料】等待10秒".format (account, shop_id))
msg ("账号【{0}】【shop_id:{2}】执行【兑换肥料】任务成功,获取【{1}】肥料".format (account, score, shop_id))
time.sleep (10)
except Exception as e:
print (e)
msg ("账号【{0}】【shop_id:{1}】肥料兑换已达上限".format (account, shop_id))
time.sleep (1)
# 浇水
def watering(cookie, plant_id, sid, account):
try:
url = 'https://xinruimz-isv.isvjcloud.com/papi/watering'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
data = r'{"plant_id":' + f"{plant_id}" + r'}'
while True:
response = requests.post (url=url, verify=False, headers=headers,
data=data.encode ()) # data中有汉字需要encode为utf-8
result = response.json ()
# print(result)
level = result['level'] # 当前等级
complete_level = result['complete_level'] # 完成等级
msg ("【账号{0}】【plant_id:{3}】成功浇水10g当前等级{1},种子成熟等级为{2}".format (account, level, complete_level, plant_id))
time.sleep (5)
except Exception as e:
print(e)
# pass
# 施肥
def fertilization(cookie, plant_id, shop_id, account):
url = 'https://xinruimz-isv.isvjcloud.com/papi/fertilization'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
data = r'{"plant_id":' + f"{plant_id}" + r'}'
i = 1
while True:
try:
response = requests.post (url=url, verify=False, headers=headers, data=data) # data中有汉字需要encode为utf-8
result = response.json ()
# print(result)
level = result['level'] # 当前等级
complete_level = result['complete_level'] # 完成等级
printT ("【账号{0}】【plant_id:{3}】成功施肥10g当前等级{1},种子成熟等级为{2}".format (account, level, complete_level, plant_id))
time.sleep (5)
i += 1
except Exception as e:
# print(e)
message = result['message']
total = i * 10
if "肥料不足" in message:
msg("【账号{0}】【plant_id:{1}】本次一共施肥{2}g".format (account, plant_id,total))
printT ("【账号{0}】【plant_id:{1}】肥料不足10g".format (account, plant_id))
break
def start():
global cookie, cookies
print (f"\n【准备开始...】\n")
nowtime = datetime.datetime.now ().strftime ('%Y-%m-%d %H:%M:%S.%f8')
if cookie != '':
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3 = get_task (cookie,account)
get_water (cookie, position_list, sid, account)
get_fertilizer (cookie, shop_id_list, account)
for i, j in zip (taskName_list, taskId_list):
do_task1 (cookie, i, j, account)
for i, j in zip (taskName_list2, taskId_list2):
do_task2 (cookie, i, j, account)
for i, j in zip (taskName_list3, taskId_list3):
do_task3 (cookie, i, j, sid, account)
flag = 0
for i in shop_id_list:
do_fertilizer_task (cookie, i, account) # 浏览关注
for k in shop_id_list:
taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4 = get_fertilizer_task (cookie, k, account)
do_fertilizer_task4 (cookie, k, account)
do_fertilizer_task5 (cookie, k, account)
if beauty_plant_exchange == 'true':
do_fertilizer_task6 (cookie, k, account)
for i, j in zip (taskName_list2, taskId_list2):
print (i, j, k)
do_fertilizer_task2 (cookie, i, j, k, account) # 浏览
for i, j in zip (taskName_list3, taskId_list3):
print (i, j, k)
do_fertilizer_task3 (cookie, i, j, k, account) # 加购
if choose_plant_id == 'false':
for i in planted_id_list:
watering (cookie, i, sid, account)
fertilization (cookie, i, k, account)
else:
fertilization (cookie, planted_id_list[flag], k, account)
watering (cookie, planted_id, sid, account)
flag += 1
elif cookies != '':
for cookie, planted_id in zip (cookies, planted_ids):
try:
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
except Exception as e:
pass
for cookie, planted_id in zip (cookies, planted_ids):
try:
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3 = get_task (cookie, account)
get_water (cookie, position_list, sid, account)
get_fertilizer (cookie, shop_id_list, account)
for i, j in zip (taskName_list, taskId_list):
do_task1 (cookie, i, j, account)
for i, j in zip (taskName_list2, taskId_list2):
do_task2 (cookie, i, j, account)
for i, j in zip (taskName_list3, taskId_list3):
do_task3 (cookie, i, j, sid, account)
flag = 0
for i in shop_id_list:
do_fertilizer_task (cookie, i, account) # 浏览关注
for k in shop_id_list:
taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4 = get_fertilizer_task (
cookie, k, account)
do_fertilizer_task4 (cookie, k, account)
do_fertilizer_task5 (cookie, k, account)
if beauty_plant_exchange == 'true':
do_fertilizer_task6 (cookie, k, account)
for i, j in zip (taskName_list2, taskId_list2):
print (i, j, k)
do_fertilizer_task2 (cookie, i, j, k, account) # 浏览
for i, j in zip (taskName_list3, taskId_list3):
print (i, j, k)
do_fertilizer_task3 (cookie, i, j, k, account) # 加购
if choose_plant_id == 'false':
for i in planted_id_list:
fertilization (cookie, i, k, account)
watering (cookie, i, sid, account)
else:
print("【账号{}现在开始施肥】".format(account))
fertilization (cookie, planted_id_list[flag], k, account)
print ("【账号{}现在开始浇水】".format (account))
watering (cookie, planted_id, sid, account)
flag += 1
except Exception as e:
pass
else:
printT ("请检查变量plant_cookie是否已填写")
if __name__ == '__main__':
printT ("美丽研究院-种植园")
start ()
# if '成熟' in msg_info:
# send ("美丽研究院-种植园", msg_info)
if '成功' in msg_info:
send ("美丽研究院-种植园", msg_info)

View File

@ -0,0 +1,363 @@
#!/bin/env python3
# -*- coding: utf-8 -*
'''
感谢CurtinLV提供的其他脚本供我参考
感谢aburd ch大佬的指导抓包
项目名称:jd_health_exchange.py
Author: 一风一燕
功能健康兑换
Date: 2021-12-19
cron: 1 0 0 * * * jd_health_exchange.py
new Env('健康兑换');
2022-1-7 updata:兑换改版更新脚本
2022-1-9 updata:
更新多线程兑换对于exchange_jkd_numb=4的人更加友好
****************滴滴出行APP*******************
教程
青龙变量exchange_jkd_numb="1"的话兑换100健康豆1福利金
青龙变量exchange_jkd_numb="2"的话兑换5000健康豆50福利金
青龙变量exchange_jkd_numb="3"的话兑换10000健康豆100福利金
青龙变量exchange_jkd_numb="4"的话兑换150000健康豆150福利金
需要自行用手机抓取Didi_jifen_token
在青龙变量中添加变量Didi_jifen_token
多个账号时Didi_jifen_token&隔开例如Didi_jifen_token="xxxxx&xxxx"
手机抓包后手动点击多看多赚签到一次后查看URLhttps://res.xiaojukeji.com/sigma/api/step/sign/v2?wsgsig=
再查看表头ticket就是需要抓的变量了
在青龙变量中添加变量Didi_jifen_token="xxxx",xxx就是上面抓的ticker复制下来就OK了
cron时间填写1 0 0 * * *
'''
Didi_jifen_token = ''
exchange_jkd_numb = 2
total_exchange = 5000
FLJ = 50
'''
=================================以下代码不懂不要随便乱动=================================
'''
tokens = ''
account = 1
try:
import requests
import json,sys,os,re
import time,datetime
from urllib.parse import quote, unquote
import threading
except Exception as e:
print(e)
requests.packages.urllib3.disable_warnings()
pwd = os.path.dirname(os.path.abspath(__file__)) + os.sep
path = pwd + "env.sh"
today = datetime.datetime.now().strftime('%Y-%m-%d')
tomorrow=(datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y-%m-%d')
#开始抢兑时间
starttime='00:01:00.00000000'
#结束时间
endtime='00:01:20.00000000'
qgtime = '{} {}'.format (today, starttime)
qgendtime = '{} {}'.format (today, endtime)
def printT(s):
print("[【{0}】]: {1}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), s))
sys.stdout.flush()
def getEnvs(label):
try:
if label == 'True' or label == 'yes' or label == 'true' or label == 'Yes':
return True
elif label == 'False' or label == 'no' or label == 'false' or label == 'No':
return False
except:
pass
try:
if '.' in label:
return float(label)
elif '&' in label:
return label.split('&')
elif '@' in label:
return label.split('@')
else:
return int(label)
except:
return label
############## 在pycharm测试ql环境用实际用下面的代码运行 #########
# with open(path, "r+", encoding="utf-8") as f:
# ck = f.read()
# tokens = ck
# if "Didi_jifen_token" in ck:
# r = re.compile (r'Didi_jifen_token="(.*?)"', re.M | re.S | re.I)
# tokens = r.findall(ck)
# tokens = tokens[0].split ('&')
# if len (tokens) == 1:
# Didi_jifen_token = tokens[0]
# tokens = ''
# # print(tokens)
# # tokens = cookies[3]
# else:
# pass
# printT ("已获取并使用ck环境 token")
########################################################################
if "Didi_jifen_token" in os.environ:
print(len (os.environ["Didi_jifen_token"]))
if len (os.environ["Didi_jifen_token"]) > 319:
tokens = os.environ["Didi_jifen_token"]
tokens = tokens.split ('&')
# tokens = tokens.split ('&')
# cookies = temporary[0]
printT ("已获取并使用Env环境Didi_jifen_token")
else:
Didi_jifen_token = os.environ["Didi_jifen_token"]
else:
print("检查变量Didi_jifen_token是否已填写")
if "exchange_jkd_numb" in os.environ:
exchange_jkd_numb = os.environ["exchange_jkd_numb"]
if exchange_jkd_numb == '1':
total_exchange = 100
FLJ = 1
elif exchange_jkd_numb == '2':
total_exchange = 5000
FLJ = 50
elif exchange_jkd_numb == '3':
total_exchange = 10000
FLJ = 100
elif exchange_jkd_numb == '4':
total_exchange = 15000
FLJ = 150
else:
printT (f"环境变量exchange_jkd_numb填写错误")
exit(0)
printT (f"已获取并使用Env环境exchange_jkd_numb兑换{FLJ}福利金,需要{total_exchange}健康豆")
else:
print("变量exchange_jkd_numb未填写默认兑换500福利金需要5000健康豆")
## 获取通知服务
class msg(object):
def __init__(self, m=''):
self.str_msg = m
self.message()
def message(self):
global msg_info
printT(self.str_msg)
try:
msg_info = "{}\n{}".format(msg_info, self.str_msg)
except:
msg_info = "{}".format(self.str_msg)
sys.stdout.flush() #这代码的作用就是刷新缓冲区。
# 当我们打印一些字符时并不是调用print函数后就立即打印的。一般会先将字符送到缓冲区然后再打印。
# 这就存在一个问题,如果你想等时间间隔的打印一些字符,但由于缓冲区没满,不会打印。就需要采取一些手段。如每次打印后强行刷新缓冲区。
def getsendNotify(self, a=0):
if a == 0:
a += 1
try:
url = 'https://gitee.com/curtinlv/Public/raw/master/sendNotify.py'
response = requests.get(url)
if 'curtinlv' in response.text:
with open('sendNotify.py', "w+", encoding="utf-8") as f:
f.write(response.text)
else:
if a < 5:
a += 1
return self.getsendNotify(a)
else:
pass
except:
if a < 5:
a += 1
return self.getsendNotify(a)
else:
pass
def main(self):
global send
cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(cur_path)
if os.path.exists(cur_path + "/sendNotify.py"):
try:
from sendNotify import send
except:
self.getsendNotify()
try:
from sendNotify import send
except:
printT("加载通知服务失败~")
else:
self.getsendNotify()
try:
from sendNotify import send
except:
printT("加载通知服务失败~")
###################
msg().main()
#获取xpsid
def get_xpsid():
try:
url = f'https://v.didi.cn/p/DpzAd35?appid=10000&lang=zh-CN&clientType=1&trip_cityid=21&datatype=101&imei=99d8f16bacaef4eef6c151bcdfa095f0&channel=102&appversion=6.2.4&trip_country=CN&TripCountry=CN&lng=113.812538&maptype=soso&os=iOS&utc_offset=480&access_key_id=1&deviceid=99d8f16bacaef4eef6c151bcdfa095f0&phone=UCvMSok42+5+tfafkxMn+A==&model=iPhone11&lat=23.016271&origin_id=1&client_type=1&terminal_id=1&sig=8503d986c0349e40ea10ff360f75d208c78c989a'
heards = {
"user-agent": f"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 didi.passenger/6.2.4 FusionKit/1.2.20 OffMode/0",
}
response = requests.head (url=url, headers=heards, verify=False) #获取响应请求头
result = response.headers['Location'] #获取响应请求头
# print(result)
r = re.compile (r'root_xpsid=(.*?)&appid', re.M | re.S | re.I)
xpsid = r.findall (result)
xpsid = xpsid[0]
print(xpsid)
return xpsid
except Exception as e:
print(e)
msg("获取xpsid失败可能是表达式错误")
#兑换福利金
def exchange(Didi_jifen_token,xpsid,account,exchange_jkd_numb):
flag2 = 0
flag3 = 0
url2 = r'https://res.xiaojukeji.com/sigma/api/coin/exchange?wsgsig=dd03-874lYEiaW6E3VTgICTc9U%2FXEkxU6r1QcAIfA%2FhQDkxU5U574bTzeUAtbVME5UTgaGPb2X9XbVxdJkHs0AHDb%2FVm0hO51WOKcDx7AWAvg%2F1FIWTbGDY0fh9vbh69E'
url3 = r'https://res.xiaojukeji.com/sigma/api/coin/exchange?wsgsig=dd03-m4G1HNtCTeCohKleO1Nzf3igzlsPlyLbPLKTAvv9zlsO%2FuY3vOsYdJiBoFCO%2FKh9pS%2Bkg3mBoVmyqoEGPHJxA3C2pVDwhoTHRHfud3tevejx%2FNUFzHjTB%2Bvcv%2Fgv'
heards = {
"Host": "res.xiaojukeji.com",
"Accept":"application/json, text/plain, */*",
"Content-Type": "application/json",
"Origin": "https://page.udache.com",
"Accept-Encoding": "gzip, deflate, br",
"Connection":"keep-alive",
"Accept-Language": "zh-CN,zh-Hans;q=0.9",
"ticket":f"{Didi_jifen_token}",
"User-Agent": f"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 didi.passenger/6.2.4 FusionKit/1.2.20 OffMode/0",
"Referer": "https://page.udache.com/",
# "Content-Length": "1013"
}
data2 = r'{"xbiz":"240300","prod_key":"","xpsid":"6da937105bd14a54a450a08bcdbe7430","dchn":"DpzAd35","xoid":"31685f47-0baa-4c2e-8636-ebff93f65c4a","uid":"281474990465673","xenv":"passenger","xspm_from":"","xpsid_root":"6da937105bd14a54a450a08bcdbe7430","xpsid_from":"409c8422dcdb4449a3598102f1008ca3","xpsid_share":"","version":1,"source_from":"app","city_id":21,"env":{"ticket":"teo9SzpY2n5ivDQiGC0WeayO8BC5UI9gF3vBKuu5bEAkzDmOAkEMQNG7_Nhq2bW5yunkc4cZaJakkEBELe6OaPKntzGVIC-6KMI0woSZCFNVFWYmzOtILRdrPY0szEJYK70WrzkJsxL8_CL8ESD8E6lb8TKGllabZ-FIDGElNh635_2wEvoSTnul7rZXZwLLtWvvzbUhXL7l9cPfAQAA__8=","cityId":"21","longitude":113.81221218532986,"latitude":23.016388346354166,"newAppid":10000,"isHitButton":true,"ddfp":"99d8f16bacaef4eef6c151bcdfa095f0","deviceId":"99d8f16bacaef4eef6c151bcdfa095f0","appVersion":"6.2.4","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 didi.passenger/6.2.4 FusionKit/1.2.20 OffMode/0","fromChannel":"1"},"type":4,"extra_number":2}'
data3 = r'{"xbiz":"240300","prod_key":"ut-walk-bonus","xpsid":"8135e26398034cb1aeede503aef54f26","dchn":"aXxR1oB","xoid":"ba403e62-5f97-4b65-a213-b389f7ed0792","uid":"281474990465673","xenv":"passenger","xspm_from":"","xpsid_root":"8135e26398034cb1aeede503aef54f26","xpsid_from":"43f880c6cfae43d1a77a6ad37bfbea94","xpsid_share":"","version":1,"source_from":"app","city_id":21,"env":{"ticket":"w-8z4gvdnylZ3fDWaIPcqhm3n2fux0T3k8oIR9valmskzDmOAkEMQNG7_Nhq2eVanU4-d5iBZkkKCUTU4u6IJn96G1MJfNFFEaYRJsxEmKqqMJ2wVkaqnq32NFyYmbCah3b3PIRZCH5-Ef4IEP6J1C23PIbmWmpz4UiYCSux8bg974eV0Jdw2i9zbft1JjAvXXuvTSvC5XteP_wdAAD__w==","cityId":"21","longitude":113.81221218532986,"latitude":23.016388346354166,"newAppid":10000,"isHitButton":true,"ddfp":"99d8f16bacaef4eef6c151bcdfa095f0","deviceId":"99d8f16bacaef4eef6c151bcdfa095f0","appVersion":"6.2.4","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 didi.passenger/6.2.4 FusionKit/1.2.20 OffMode/0","fromChannel":"1"},"type":4,"extra_number":3}'
# print(data)
printT("抢兑换开始时间为:{}".format (qgtime))
printT (f"正在等待兑换时间,请勿终止退出...")
try:
while True:
nowtime = datetime.datetime.now ().strftime ('%Y-%m-%d %H:%M:%S.%f8')
if nowtime > qgtime:
if exchange_jkd_numb == '2':
response = requests.post (url=url2, headers=heards,verify=False,data=data2)
# print(response.text)
result = response.json()
print(result)
errmsg = result['errmsg']
if errmsg == 'success':
msg("【账号{0}】已兑换{1}健康豆,获得福利金{2}".format(account,total_exchange,FLJ))
flag2 = 1
break
elif "代币兑换错误" in errmsg:
print("【账号{0}】今日兑换【50】福利金可能已达上限".format(account))
if flag2 == 1:
break
elif exchange_jkd_numb == '3':
response = requests.post (url=url3, headers=heards, verify=False, data=data3)
result = response.json ()
print (result)
errmsg = result['errmsg']
if errmsg == 'success':
msg ("【账号{0}】已兑换{1}健康豆,获得福利金{2}".format (account, total_exchange, FLJ))
flag3 = 1
break
elif "代币兑换错误" in errmsg:
print ("【账号{0}】今日兑换【100】福利金可能已达上限".format(account))
if flag3 == 1:
break
elif exchange_jkd_numb == '4':
response = requests.post (url=url2, headers=heards, verify=False, data=data2)
result = response.json ()
print (result)
errmsg = result['errmsg']
if errmsg == 'success':
msg ("【账号{0}】已兑换5000健康豆获得福利金50".format (account))
flag2 = 1
elif "代币兑换错误" in errmsg:
print ("【账号{0}】今日兑换【50福利金】可能已达上限".format(account))
response = requests.post (url=url3, headers=heards, verify=False, data=data3)
result = response.json ()
print (result)
errmsg = result['errmsg']
if errmsg == 'success':
msg ("【账号{0}】已兑换10000健康豆获得福利金100".format (account))
flag3 = 1
elif "代币兑换错误" in errmsg:
print ("【账号{0}】今日兑换【100福利金】可能已达上限".format(account))
if nowtime > qgendtime:
if flag2 == 0 and flag3 == 0:
msg ("【账号{0}】脚本执行完毕,兑换失败".format (account))
break
elif flag2 == 1 and flag3 == 1:
msg("【账号{0}】脚本执行完毕共获得福利金150".format(account))
break
elif flag2 == 0 and flag3 == 1:
msg ("【账号{0}】脚本执行完毕共获得福利金100".format(account))
break
elif flag2 == 1 and flag3 == 0:
msg ("【账号{0}】脚本执行完毕共获得福利金50".format(account))
break
except Exception as e:
print (e)
if __name__ == '__main__':
print("============脚本只支持青龙新版=============\n")
print("具体教程以文本模式打开文件,查看顶部教程\n")
print("============执行滴滴多走多赚兑换脚本==============")
# print(Didi_jifen_token)
if Didi_jifen_token != '':
xpsid = get_xpsid ()
exchange (Didi_jifen_token, xpsid, account, exchange_jkd_numb)
elif tokens == '' :
print("检查变量Didi_jifen_token是否已填写")
elif len(tokens) > 1 :
account = 1
ttt = []
for i in tokens: #同时遍历两个list需要用ZIP打包
xpsid = get_xpsid ()
thread = threading.Thread(target=exchange, args=(i, xpsid, account, exchange_jkd_numb))
ttt.append (thread)
thread.start ()
account += 1
for thread in ttt:
thread.join ()
if "已兑换" in msg_info:
send("滴滴多走多赚兑换", msg_info)
elif "过期" in msg_info:
send("滴滴多走多赚兑换", msg_info)