├── README.md
├── ym
├── README.md
├── tyyp.py
├── tyyp2.py
├── tyyp3.py
├── tyyp1.py
├── 阿里云盘.py
├── twkj.js
├── 燕京啤酒.js
├── ttl.js
├── bak
│ └── lmz.js
└── 顺丰.js
├── backUp
├── README.md
├── qlylxiufuban.sh
└── qlyl.sh
└── bak
├── README.md
├── jd_9.9-6.js
├── jd_29_8.js
├── jd_19_6.js
├── jd_5_2.js
└── jd_10_4.js
/README.md:
--------------------------------------------------------------------------------
1 | 自用脚本库
2 |
--------------------------------------------------------------------------------
/ym/README.md:
--------------------------------------------------------------------------------
1 | 一些小羊毛
2 |
--------------------------------------------------------------------------------
/backUp/README.md:
--------------------------------------------------------------------------------
1 | 依赖文件
2 |
--------------------------------------------------------------------------------
/bak/README.md:
--------------------------------------------------------------------------------
1 | 存放 过期或失效脚本
2 |
--------------------------------------------------------------------------------
/backUp/qlylxiufuban.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 |
4 | # 青龙一键安装脚本
5 | # GitHub仓库: https://github.com/FlechazoPh/QLDependency
6 | TIME() {
7 | [[ -z "$1" ]] && {
8 | echo -ne " "
9 | } || {
10 | case $1 in
11 | r) export Color="\e[31;1m";;
12 | g) export Color="\e[32;1m";;
13 | b) export Color="\e[34;1m";;
14 | y) export Color="\e[33;1m";;
15 | z) export Color="\e[35;1m";;
16 | l) export Color="\e[36;1m";;
17 | esac
18 | [[ $# -lt 2 ]] && echo -e "\e[36m\e[0m ${1}" || {
19 | echo -e "\e[36m\e[0m ${Color}${2}\e[0m"
20 | }
21 | }
22 | }
23 | echo
24 | echo
25 | echo
26 | TIME l "安装依赖..."
27 | echo
28 | TIME y "安装依赖需要时间,请耐心等待!"
29 | echo
30 | sleep 3
31 | echo
32 | echo
33 | npm config set registry https://registry.npm.taobao.org
34 | cd /ql
35 | npm install -g tough-cookie
36 | cd /ql
37 | npm install -g jsdom
38 | cd /ql
39 | npm install -g download
40 | cd /ql
41 | npm install -g tunnel
42 | cd /ql
43 | npm install -g moment
44 | cd /ql
45 | npm install -g ws
46 | cd /ql
47 | npm install -g canvas
48 | cd /ql
49 | npm install -g form-data
50 | cd /ql
51 | npm install -g ts-node
52 | cd /ql
53 | pip3 install yargs
54 | cd /ql
55 | pip3 install json5
56 | cd /ql
57 | pip3 install iconv-lite
58 | cd /ql
59 | pip3 install js-base64
60 | cd /ql
61 | echo
62 | TIME g "依赖安装完毕..."
63 | echo
64 | exit 0
--------------------------------------------------------------------------------
/backUp/qlyl.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 |
4 | # 青龙一键安装脚本
5 | # GitHub仓库: https://github.com/FlechazoPh/QLDependency
6 | TIME() {
7 | [[ -z "$1" ]] && {
8 | echo -ne " "
9 | } || {
10 | case $1 in
11 | r) export Color="\e[31;1m";;
12 | g) export Color="\e[32;1m";;
13 | b) export Color="\e[34;1m";;
14 | y) export Color="\e[33;1m";;
15 | z) export Color="\e[35;1m";;
16 | l) export Color="\e[36;1m";;
17 | esac
18 | [[ $# -lt 2 ]] && echo -e "\e[36m\e[0m ${1}" || {
19 | echo -e "\e[36m\e[0m ${Color}${2}\e[0m"
20 | }
21 | }
22 | }
23 | echo
24 | echo
25 | echo
26 | TIME l "安装依赖..."
27 | echo
28 | TIME y "安装依赖需要时间,请耐心等待!"
29 | echo
30 | sleep 3
31 | echo
32 | echo
33 | npm config set registry https://registry.npm.taobao.org
34 | cd /ql
35 | npm install -g npm
36 | cd /ql
37 | npm install -g png-js
38 | cd /ql
39 | npm install -g date-fns
40 | cd /ql
41 | npm install -g axios
42 | cd /ql
43 | npm install -g crypto-js
44 | cd /ql
45 | npm install -g ts-md5
46 | cd /ql
47 | npm install -g tslib
48 | cd /ql
49 | npm install -g @types/node
50 | cd /ql
51 | npm install -g requests
52 | cd /ql
53 | npm install -g tough-cookie
54 | cd /ql
55 | npm install -g jsdom
56 | cd /ql
57 | npm install -g download
58 | cd /ql
59 | npm install -g tunnel
60 | cd /ql
61 | npm install -g fs
62 | cd /ql
63 | npm install -g moment
64 | cd /ql
65 | npm install -g qs
66 | cd /ql
67 | npm install -g ws
68 | cd /ql
69 | npm install -g form-data
70 | cd /ql
71 | pip3 install requests
72 | cd /ql
73 | pip3 install jieba
74 | cd /ql
75 | pip3 install PyExecJS
76 | cd /ql
77 | pip3 install pip
78 | cd /ql
79 | pip3 install setuptools
80 | cd /ql
81 | pip3 install dotenv
82 | cd /ql
83 | pip3 install yargs
84 | cd /ql
85 | pip3 install json5
86 | cd /ql
87 | pip3 install tslib
88 | cd /ql
89 | pip3 install iconv-lite
90 | cd /ql
91 | pip3 install js-base64
92 | cd /ql
93 | cd /ql/scripts/ && apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i && npm i -S ts-node typescript @types/node date-fns axios png-js canvas --build-from-source
94 | cd /ql
95 | apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && cd scripts && npm install canvas --build-from-source
96 | cd /ql
97 | apk add python3 zlib-dev gcc jpeg-dev python3-dev musl-dev freetype-dev
98 | cd /ql
99 | echo
100 | TIME g "依赖安装完毕..."
101 | echo
102 | exit 0
--------------------------------------------------------------------------------
/ym/tyyp.py:
--------------------------------------------------------------------------------
1 | import base64
2 | import json
3 | import re
4 | import time
5 | import requests
6 | import rsa
7 |
8 | #账号:手机号
9 | account = [
10 | {"password": "Zz123456", "phone": "13850502511"},
11 | {"password": "Zz123456", "phone": "18965461016"},
12 | {"password": "Zz123456", "phone": "13774753771"}
13 | ]
14 |
15 | # Server酱sendKey获取 https://sct.ftqq.com/
16 | sendKey = ''
17 |
18 |
19 |
20 |
21 | def int2char(a):
22 | return list("0123456789abcdefghijklmnopqrstuvwxyz")[a]
23 |
24 |
25 | def b64tohex(a):
26 | b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
27 | d = ""
28 | e = 0
29 | c = 0
30 | for i in range(len(a)):
31 | if list(a)[i] != "=":
32 | v = b64map.index(list(a)[i])
33 | if 0 == e:
34 | e = 1
35 | d += int2char(v >> 2)
36 | c = 3 & v
37 | elif 1 == e:
38 | e = 2
39 | d += int2char(c << 2 | v >> 4)
40 | c = 15 & v
41 | elif 2 == e:
42 | e = 3
43 | d += int2char(c)
44 | d += int2char(v >> 2)
45 | c = 3 & v
46 | else:
47 | e = 0
48 | d += int2char(c << 2 | v >> 4)
49 | d += int2char(15 & v)
50 | if e == 1:
51 | d += int2char(c << 2)
52 | return d
53 |
54 |
55 | def rsa_encode(j_rsakey, string):
56 | rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----"
57 | pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())
58 | result = b64tohex((base64.b64encode(rsa.encrypt(f"{string}".encode(), pubkey))).decode())
59 | return result
60 |
61 |
62 | def login(session, username, password):
63 | url = "https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html"
64 | r = session.get(url=url)
65 | captchatoken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0]
66 | lt = re.findall(r'lt = "(.+?)"', r.text)[0]
67 | returnurl = re.findall(r"returnUrl = '(.+?)'", r.text)[0]
68 | paramid = re.findall(r'paramId = "(.+?)"', r.text)[0]
69 | j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0]
70 | session.headers.update({"lt": lt})
71 |
72 | username = rsa_encode(j_rsakey, username)
73 | password = rsa_encode(j_rsakey, password)
74 | url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do"
75 | headers = {
76 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0",
77 | "Referer": "https://open.e.189.cn/",
78 | }
79 | data = {
80 | "appKey": "cloud",
81 | "accountType": "01",
82 | "userName": f"{{RSA}}{username}",
83 | "password": f"{{RSA}}{password}",
84 | "validateCode": "",
85 | "captchaToken": captchatoken,
86 | "returnUrl": returnurl,
87 | "mailSuffix": "@189.cn",
88 | "paramId": paramid,
89 | }
90 | r = session.post(url, data=data, headers=headers, timeout=5)
91 | if r.json()["result"] == 0:
92 | redirect_url = r.json()["toUrl"]
93 | session.get(url=redirect_url)
94 | return True
95 | else:
96 | return {"name": "登陆信息", "value": r.json()["msg"]}
97 |
98 |
99 | def sign(session):
100 | rand = str(round(time.time() * 1000))
101 | surl = f"https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K"
102 | url = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN"
103 | url2 = "https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN"
104 | headers = {
105 | "User-Agent": "Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6",
106 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
107 | "Host": "m.cloud.189.cn",
108 | "Accept-Encoding": "gzip, deflate",
109 | }
110 | response = session.get(url=surl, headers=headers)
111 | netdiskbonus = response.json().get("netdiskBonus")
112 | msg = []
113 | if response.json().get("isSign") == "false":
114 | msg.append({"name": "签到结果", "value": f"未签到,签到获得 {netdiskbonus}M 空间"})
115 | else:
116 | msg.append({"name": "签到结果", "value": f"已经签到过了,签到获得 {netdiskbonus}M 空间"})
117 | response = session.get(url=url, headers=headers)
118 | if "errorCode" in response.text:
119 | if response.json().get("errorCode") == "User_Not_Chance":
120 | description = "没有抽奖机会了"
121 | else:
122 | description = response.json().get("errorCode")
123 | msg.append({"name": "第一次抽", "value": description})
124 | else:
125 | description = response.json().get("description", "")
126 | if description in ["1", 1]:
127 | description = "50M空间"
128 | msg.append({"name": "第一次抽", "value": f"获得{description}"})
129 | response = session.get(url=url2, headers=headers)
130 | if "errorCode" in response.text:
131 | if response.json().get("errorCode") == "User_Not_Chance":
132 | description = "没有抽奖机会了"
133 | else:
134 | description = response.json().get("errorCode")
135 | msg.append({"name": "第二次抽", "value": description})
136 | else:
137 | description = response.json().get("description", "")
138 | if description in ["1", 1]:
139 | description = "50M空间"
140 | msg.append({"name": "第二次抽", "value": f"获得{description}"})
141 | return msg
142 |
143 |
144 | def checkin(data):
145 | cloud189_phone = data["phone"]
146 | cloud189_password = data["password"]
147 | session = requests.Session()
148 | flag = login(session=session, username=cloud189_phone, password=cloud189_password)
149 | if flag is True:
150 | sign_msg = sign(session=session)
151 | else:
152 | sign_msg = flag
153 | msg = [{"name": "帐号信息", "value": cloud189_phone}] + sign_msg
154 | msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])
155 | return msg
156 |
157 |
158 | def main():
159 | text_content = ''
160 | for i in account:
161 | msg = checkin(data=i)
162 | print(msg)
163 | text_content = text_content + msg
164 | text_title = '天翼云盘 签到通知'
165 | url = f"https://sctapi.ftqq.com/{sendKey}.send"
166 | headers = {'Content-Type': 'application/x-www-form-urlencoded'}
167 | data = {
168 | 'text': f"{text_title}",
169 | 'content': f"{text_content}"
170 | }
171 | response = requests.post(url, headers=headers, data=data)
172 | print(json.loads(response.text))
173 |
174 | if __name__ == '__main__':
175 | main()
176 | # ------- 腾讯云函数启动模块 --------#
177 | def main_handler(event, context):
178 | main()
179 |
180 | # ------- 阿里云函数启动模块 -------- #
181 | def handler(event, context):
182 | main()
183 |
--------------------------------------------------------------------------------
/ym/tyyp2.py:
--------------------------------------------------------------------------------
1 | # 来自吾爱论坛,在原作者的基础上把推送消息换成了青龙自带的通知,如有侵权请告知,将立即删除。
2 | # @author Sten
3 | # 我的仓库:https://github.com/aefa6/QinglongScript.git
4 | # 觉得不错麻烦点个star谢谢
5 | #!/usr/bin/python
6 | # coding=utf-8
7 | '''
8 | cron: 31 6,18 * * *
9 | new Env('天翼云盘2');
10 | '''
11 | import notify
12 | import time
13 | import re
14 | import json
15 | import base64
16 | import hashlib
17 | import urllib.parse,hmac
18 | import rsa
19 | import requests
20 | import random
21 |
22 | BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
23 |
24 | B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
25 |
26 | s = requests.Session()
27 |
28 | # 在下面两行的引号内贴上账号(仅支持手机号)和密码
29 | username = "18965461016"
30 | password = "Zz123456"
31 |
32 | _ = """
33 | if(username == "" or password == ""):
34 | username = input("账号:")
35 | password = input("密码:")
36 | # """
37 |
38 | assert username and password, "在第23、24行填入有效账号和密码"
39 |
40 | def int2char(a):
41 | return BI_RM[a]
42 |
43 |
44 | def b64tohex(a):
45 | d = ""
46 | e = 0
47 | c = 0
48 | for i in range(len(a)):
49 | if list(a)[i] != "=":
50 | v = B64MAP.index(list(a)[i])
51 | if 0 == e:
52 | e = 1
53 | d += int2char(v >> 2)
54 | c = 3 & v
55 | elif 1 == e:
56 | e = 2
57 | d += int2char(c << 2 | v >> 4)
58 | c = 15 & v
59 | elif 2 == e:
60 | e = 3
61 | d += int2char(c)
62 | d += int2char(v >> 2)
63 | c = 3 & v
64 | else:
65 | e = 0
66 | d += int2char(c << 2 | v >> 4)
67 | d += int2char(15 & v)
68 | if e == 1:
69 | d += int2char(c << 2)
70 | return d
71 |
72 |
73 | def rsa_encode(j_rsakey, string):
74 | rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----"
75 | pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())
76 | result = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
77 | return result
78 |
79 |
80 | def calculate_md5_sign(params):
81 | return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()
82 |
83 |
84 | def login(username, password):
85 | #https://m.cloud.189.cn/login2014.jsp?redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html
86 | url=""
87 | urlToken="https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html"
88 | s = requests.Session()
89 | r = s.get(urlToken)
90 | pattern = r"https?://[^\s'\"]+" # 匹配以http或https开头的url
91 | match = re.search(pattern, r.text) # 在文本中搜索匹配
92 | if match: # 如果找到匹配
93 | url = match.group() # 获取匹配的字符串
94 | # print(url) # 打印url
95 | else: # 如果没有找到匹配
96 | print("没有找到url")
97 |
98 | r = s.get(url)
99 | # print(r.text)
100 | pattern = r"]*href=\"([^\"]+)\"" # 匹配id为j-tab-login-link的a标签,并捕获href引号内的内容
101 | match = re.search(pattern, r.text) # 在文本中搜索匹配
102 | if match: # 如果找到匹配
103 | href = match.group(1) # 获取捕获的内容
104 | # print("href:" + href) # 打印href链接
105 | else: # 如果没有找到匹配
106 | print("没有找到href链接")
107 |
108 | r = s.get(href)
109 | captchaToken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0]
110 | lt = re.findall(r'lt = "(.+?)"', r.text)[0]
111 | returnUrl = re.findall(r"returnUrl= '(.+?)'", r.text)[0]
112 | paramId = re.findall(r'paramId = "(.+?)"', r.text)[0]
113 | j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0]
114 | s.headers.update({"lt": lt})
115 |
116 | username = rsa_encode(j_rsakey, username)
117 | password = rsa_encode(j_rsakey, password)
118 | url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do"
119 | headers = {
120 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0',
121 | 'Referer': 'https://open.e.189.cn/',
122 | }
123 | data = {
124 | "appKey": "cloud",
125 | "accountType": '01',
126 | "userName": f"{{RSA}}{username}",
127 | "password": f"{{RSA}}{password}",
128 | "validateCode": "",
129 | "captchaToken": captchaToken,
130 | "returnUrl": returnUrl,
131 | "mailSuffix": "@189.cn",
132 | "paramId": paramId
133 | }
134 | r = s.post(url, data=data, headers=headers, timeout=5)
135 | if (r.json()['result'] == 0):
136 | print(r.json()['msg'])
137 | else:
138 | print(r.json()['msg'])
139 | redirect_url = r.json()['toUrl']
140 | r = s.get(redirect_url)
141 | return s
142 |
143 |
144 | def main():
145 | s=login(username, password)
146 | rand = str(round(time.time() * 1000))
147 | surl = f'https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K'
148 | url = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
149 | url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
150 | url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN'
151 | headers = {
152 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
153 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
154 | "Host": "m.cloud.189.cn",
155 | "Accept-Encoding": "gzip, deflate",
156 | }
157 | response = s.get(surl, headers=headers)
158 | netdiskBonus = response.json()['netdiskBonus']
159 | if (response.json()['isSign'] == "false"):
160 | print(f"未签到,签到获得{netdiskBonus}M空间")
161 | res1 = f"未签到,签到获得{netdiskBonus}M空间"
162 | else:
163 | print(f"已经签到过了,签到获得{netdiskBonus}M空间")
164 | res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"
165 |
166 | headers = {
167 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
168 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
169 | "Host": "m.cloud.189.cn",
170 | "Accept-Encoding": "gzip, deflate",
171 | }
172 | response = s.get(url, headers=headers)
173 | if ("errorCode" in response.text):
174 | print(response.text)
175 | res2 = ""
176 | else:
177 | description = response.json()['description']
178 | print(f"抽奖获得{description}")
179 | res2 = f"抽奖获得{description}"
180 | response = s.get(url2, headers=headers)
181 | if ("errorCode" in response.text):
182 | print(response.text)
183 | res3 = ""
184 | else:
185 | description = response.json()['description']
186 | print(f"抽奖获得{description}")
187 | res3 = f"抽奖获得{description}"
188 |
189 | response = s.get(url3, headers=headers)
190 | if ("errorCode" in response.text):
191 | print(response.text)
192 | res4 = ""
193 | else:
194 | description = response.json()['description']
195 | print(f"链接3抽奖获得{description}")
196 | res4 = f"链接3抽奖获得{description}"
197 |
198 | title = "天翼云签到"
199 | content = f"""
200 | {res1}
201 | {res2}
202 | {res3}
203 | {res4}
204 | """
205 | notify.send(title, content)
206 |
207 | def lambda_handler(event, context): # aws default
208 | main()
209 |
210 |
211 | def main_handler(event, context): # tencent default
212 | main()
213 |
214 |
215 | def handler(event, context): # aliyun default
216 | main()
217 |
218 |
219 | if __name__ == "__main__":
220 | # time.sleep(random.randint(5, 30))
221 | main()
222 |
--------------------------------------------------------------------------------
/ym/tyyp3.py:
--------------------------------------------------------------------------------
1 | # 来自吾爱论坛,在原作者的基础上把推送消息换成了青龙自带的通知,如有侵权请告知,将立即删除。
2 | # @author Sten
3 | # 我的仓库:https://github.com/aefa6/QinglongScript.git
4 | # 觉得不错麻烦点个star谢谢
5 | #!/usr/bin/python
6 | # coding=utf-8
7 | '''
8 | cron: 30 6,18 * * *
9 | new Env('天翼云盘3');
10 | '''
11 | import notify
12 | import time
13 | import re
14 | import json
15 | import base64
16 | import hashlib
17 | import urllib.parse,hmac
18 | import rsa
19 | import requests
20 | import random
21 |
22 | BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
23 |
24 | B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
25 |
26 | s = requests.Session()
27 |
28 | # 在下面两行的引号内贴上账号(仅支持手机号)和密码
29 | username = "13774753771"
30 | password = "Zz123456"
31 |
32 | _ = """
33 | if(username == "" or password == ""):
34 | username = input("账号:")
35 | password = input("密码:")
36 | # """
37 |
38 | assert username and password, "在第23、24行填入有效账号和密码"
39 |
40 | def int2char(a):
41 | return BI_RM[a]
42 |
43 |
44 | def b64tohex(a):
45 | d = ""
46 | e = 0
47 | c = 0
48 | for i in range(len(a)):
49 | if list(a)[i] != "=":
50 | v = B64MAP.index(list(a)[i])
51 | if 0 == e:
52 | e = 1
53 | d += int2char(v >> 2)
54 | c = 3 & v
55 | elif 1 == e:
56 | e = 2
57 | d += int2char(c << 2 | v >> 4)
58 | c = 15 & v
59 | elif 2 == e:
60 | e = 3
61 | d += int2char(c)
62 | d += int2char(v >> 2)
63 | c = 3 & v
64 | else:
65 | e = 0
66 | d += int2char(c << 2 | v >> 4)
67 | d += int2char(15 & v)
68 | if e == 1:
69 | d += int2char(c << 2)
70 | return d
71 |
72 |
73 | def rsa_encode(j_rsakey, string):
74 | rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----"
75 | pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())
76 | result = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
77 | return result
78 |
79 |
80 | def calculate_md5_sign(params):
81 | return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()
82 |
83 |
84 | def login(username, password):
85 | #https://m.cloud.189.cn/login2014.jsp?redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html
86 | url=""
87 | urlToken="https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html"
88 | s = requests.Session()
89 | r = s.get(urlToken)
90 | pattern = r"https?://[^\s'\"]+" # 匹配以http或https开头的url
91 | match = re.search(pattern, r.text) # 在文本中搜索匹配
92 | if match: # 如果找到匹配
93 | url = match.group() # 获取匹配的字符串
94 | # print(url) # 打印url
95 | else: # 如果没有找到匹配
96 | print("没有找到url")
97 |
98 | r = s.get(url)
99 | # print(r.text)
100 | pattern = r"]*href=\"([^\"]+)\"" # 匹配id为j-tab-login-link的a标签,并捕获href引号内的内容
101 | match = re.search(pattern, r.text) # 在文本中搜索匹配
102 | if match: # 如果找到匹配
103 | href = match.group(1) # 获取捕获的内容
104 | # print("href:" + href) # 打印href链接
105 | else: # 如果没有找到匹配
106 | print("没有找到href链接")
107 |
108 | r = s.get(href)
109 | captchaToken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0]
110 | lt = re.findall(r'lt = "(.+?)"', r.text)[0]
111 | returnUrl = re.findall(r"returnUrl= '(.+?)'", r.text)[0]
112 | paramId = re.findall(r'paramId = "(.+?)"', r.text)[0]
113 | j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0]
114 | s.headers.update({"lt": lt})
115 |
116 | username = rsa_encode(j_rsakey, username)
117 | password = rsa_encode(j_rsakey, password)
118 | url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do"
119 | headers = {
120 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0',
121 | 'Referer': 'https://open.e.189.cn/',
122 | }
123 | data = {
124 | "appKey": "cloud",
125 | "accountType": '01',
126 | "userName": f"{{RSA}}{username}",
127 | "password": f"{{RSA}}{password}",
128 | "validateCode": "",
129 | "captchaToken": captchaToken,
130 | "returnUrl": returnUrl,
131 | "mailSuffix": "@189.cn",
132 | "paramId": paramId
133 | }
134 | r = s.post(url, data=data, headers=headers, timeout=5)
135 | if (r.json()['result'] == 0):
136 | print(r.json()['msg'])
137 | else:
138 | print(r.json()['msg'])
139 | redirect_url = r.json()['toUrl']
140 | r = s.get(redirect_url)
141 | return s
142 |
143 |
144 | def main():
145 | s=login(username, password)
146 | rand = str(round(time.time() * 1000))
147 | surl = f'https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K'
148 | url = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
149 | url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
150 | url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN'
151 | headers = {
152 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
153 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
154 | "Host": "m.cloud.189.cn",
155 | "Accept-Encoding": "gzip, deflate",
156 | }
157 | response = s.get(surl, headers=headers)
158 | netdiskBonus = response.json()['netdiskBonus']
159 | if (response.json()['isSign'] == "false"):
160 | print(f"未签到,签到获得{netdiskBonus}M空间")
161 | res1 = f"未签到,签到获得{netdiskBonus}M空间"
162 | else:
163 | print(f"已经签到过了,签到获得{netdiskBonus}M空间")
164 | res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"
165 |
166 | headers = {
167 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
168 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
169 | "Host": "m.cloud.189.cn",
170 | "Accept-Encoding": "gzip, deflate",
171 | }
172 | response = s.get(url, headers=headers)
173 | if ("errorCode" in response.text):
174 | print(response.text)
175 | res2 = ""
176 | else:
177 | description = response.json()['description']
178 | print(f"抽奖获得{description}")
179 | res2 = f"抽奖获得{description}"
180 | response = s.get(url2, headers=headers)
181 | if ("errorCode" in response.text):
182 | print(response.text)
183 | res3 = ""
184 | else:
185 | description = response.json()['description']
186 | print(f"抽奖获得{description}")
187 | res3 = f"抽奖获得{description}"
188 |
189 | response = s.get(url3, headers=headers)
190 | if ("errorCode" in response.text):
191 | print(response.text)
192 | res4 = ""
193 | else:
194 | description = response.json()['description']
195 | print(f"链接3抽奖获得{description}")
196 | res4 = f"链接3抽奖获得{description}"
197 |
198 | title = "天翼云签到"
199 | content = f"""
200 | {res1}
201 | {res2}
202 | {res3}
203 | {res4}
204 | """
205 | notify.send(title, content)
206 |
207 | def lambda_handler(event, context): # aws default
208 | main()
209 |
210 |
211 | def main_handler(event, context): # tencent default
212 | main()
213 |
214 |
215 | def handler(event, context): # aliyun default
216 | main()
217 |
218 |
219 | if __name__ == "__main__":
220 | # time.sleep(random.randint(5, 30))
221 | main()
222 |
--------------------------------------------------------------------------------
/ym/tyyp1.py:
--------------------------------------------------------------------------------
1 | # 来自吾爱论坛,在原作者的基础上把推送消息换成了青龙自带的通知,如有侵权请告知,将立即删除。
2 | # @author Sten
3 | # 我的仓库:https://github.com/aefa6/QinglongScript.git
4 | # 觉得不错麻烦点个star谢谢
5 | #!/usr/bin/python
6 | # coding=utf-8
7 | '''
8 | cron: 30 6,18 * * *
9 | new Env('天翼云盘1');
10 | '''
11 |
12 | import notify
13 | import time
14 | import re
15 | import json
16 | import base64
17 | import hashlib
18 | import urllib.parse,hmac
19 | import rsa
20 | import requests
21 | import random
22 |
23 | BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")
24 |
25 | B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
26 |
27 | s = requests.Session()
28 |
29 | # 在下面两行的引号内贴上账号(仅支持手机号)和密码
30 | username = "13850502511"
31 | password = "Zz123456"
32 |
33 | _ = """
34 | if(username == "" or password == ""):
35 | username = input("账号:")
36 | password = input("密码:")
37 | # """
38 |
39 | assert username and password, "在第23、24行填入有效账号和密码"
40 |
41 | def int2char(a):
42 | return BI_RM[a]
43 |
44 |
45 | def b64tohex(a):
46 | d = ""
47 | e = 0
48 | c = 0
49 | for i in range(len(a)):
50 | if list(a)[i] != "=":
51 | v = B64MAP.index(list(a)[i])
52 | if 0 == e:
53 | e = 1
54 | d += int2char(v >> 2)
55 | c = 3 & v
56 | elif 1 == e:
57 | e = 2
58 | d += int2char(c << 2 | v >> 4)
59 | c = 15 & v
60 | elif 2 == e:
61 | e = 3
62 | d += int2char(c)
63 | d += int2char(v >> 2)
64 | c = 3 & v
65 | else:
66 | e = 0
67 | d += int2char(c << 2 | v >> 4)
68 | d += int2char(15 & v)
69 | if e == 1:
70 | d += int2char(c << 2)
71 | return d
72 |
73 |
74 | def rsa_encode(j_rsakey, string):
75 | rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----"
76 | pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())
77 | result = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
78 | return result
79 |
80 |
81 | def calculate_md5_sign(params):
82 | return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()
83 |
84 |
85 | def login(username, password):
86 | #https://m.cloud.189.cn/login2014.jsp?redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html
87 | url=""
88 | urlToken="https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html"
89 | s = requests.Session()
90 | r = s.get(urlToken)
91 | pattern = r"https?://[^\s'\"]+" # 匹配以http或https开头的url
92 | match = re.search(pattern, r.text) # 在文本中搜索匹配
93 | if match: # 如果找到匹配
94 | url = match.group() # 获取匹配的字符串
95 | # print(url) # 打印url
96 | else: # 如果没有找到匹配
97 | print("没有找到url")
98 |
99 | r = s.get(url)
100 | # print(r.text)
101 | pattern = r"]*href=\"([^\"]+)\"" # 匹配id为j-tab-login-link的a标签,并捕获href引号内的内容
102 | match = re.search(pattern, r.text) # 在文本中搜索匹配
103 | if match: # 如果找到匹配
104 | href = match.group(1) # 获取捕获的内容
105 | # print("href:" + href) # 打印href链接
106 | else: # 如果没有找到匹配
107 | print("没有找到href链接")
108 |
109 | r = s.get(href)
110 | captchaToken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0]
111 | lt = re.findall(r'lt = "(.+?)"', r.text)[0]
112 | returnUrl = re.findall(r"returnUrl= '(.+?)'", r.text)[0]
113 | paramId = re.findall(r'paramId = "(.+?)"', r.text)[0]
114 | j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0]
115 | s.headers.update({"lt": lt})
116 |
117 | username = rsa_encode(j_rsakey, username)
118 | password = rsa_encode(j_rsakey, password)
119 | url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do"
120 | headers = {
121 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0',
122 | 'Referer': 'https://open.e.189.cn/',
123 | }
124 | data = {
125 | "appKey": "cloud",
126 | "accountType": '01',
127 | "userName": f"{{RSA}}{username}",
128 | "password": f"{{RSA}}{password}",
129 | "validateCode": "",
130 | "captchaToken": captchaToken,
131 | "returnUrl": returnUrl,
132 | "mailSuffix": "@189.cn",
133 | "paramId": paramId
134 | }
135 | r = s.post(url, data=data, headers=headers, timeout=5)
136 | if (r.json()['result'] == 0):
137 | print(r.json()['msg'])
138 | else:
139 | print(r.json()['msg'])
140 | redirect_url = r.json()['toUrl']
141 | r = s.get(redirect_url)
142 | return s
143 |
144 |
145 | def main():
146 | s=login(username, password)
147 | rand = str(round(time.time() * 1000))
148 | surl = f'https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K'
149 | url = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
150 | url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
151 | url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN'
152 | headers = {
153 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
154 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
155 | "Host": "m.cloud.189.cn",
156 | "Accept-Encoding": "gzip, deflate",
157 | }
158 | response = s.get(surl, headers=headers)
159 | netdiskBonus = response.json()['netdiskBonus']
160 | if (response.json()['isSign'] == "false"):
161 | print(f"未签到,签到获得{netdiskBonus}M空间")
162 | res1 = f"未签到,签到获得{netdiskBonus}M空间"
163 | else:
164 | print(f"已经签到过了,签到获得{netdiskBonus}M空间")
165 | res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"
166 |
167 | headers = {
168 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
169 | "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
170 | "Host": "m.cloud.189.cn",
171 | "Accept-Encoding": "gzip, deflate",
172 | }
173 | response = s.get(url, headers=headers)
174 | if ("errorCode" in response.text):
175 | print(response.text)
176 | res2 = ""
177 | else:
178 | description = response.json()['description']
179 | print(f"抽奖获得{description}")
180 | res2 = f"抽奖获得{description}"
181 | response = s.get(url2, headers=headers)
182 | if ("errorCode" in response.text):
183 | print(response.text)
184 | res3 = ""
185 | else:
186 | description = response.json()['description']
187 | print(f"抽奖获得{description}")
188 | res3 = f"抽奖获得{description}"
189 |
190 | response = s.get(url3, headers=headers)
191 | if ("errorCode" in response.text):
192 | print(response.text)
193 | res4 = ""
194 | else:
195 | description = response.json()['description']
196 | print(f"链接3抽奖获得{description}")
197 | res4 = f"链接3抽奖获得{description}"
198 |
199 | title = "天翼云签到"
200 | content = f"""
201 | {res1}
202 | {res2}
203 | {res3}
204 | {res4}
205 | """
206 | notify.send(title, content)
207 |
208 | def lambda_handler(event, context): # aws default
209 | main()
210 |
211 |
212 | def main_handler(event, context): # tencent default
213 | main()
214 |
215 |
216 | def handler(event, context): # aliyun default
217 | main()
218 |
219 |
220 | if __name__ == "__main__":
221 | # time.sleep(random.randint(5, 30))
222 | main()
223 |
--------------------------------------------------------------------------------
/ym/阿里云盘.py:
--------------------------------------------------------------------------------
1 | # 在原作者的基础上更换成青龙通用的通知接口,其他代码全部照搬的,如有侵权请告知,立即删除。
2 | # @author Sten
3 | # 作者仓库:https://github.com/aefa6/QinglongScript.git
4 | # 觉得不错麻烦点个star谢谢
5 |
6 | #!/usr/bin/python
7 | # coding=utf-8
8 | '''
9 | File: aliyunpan_sign.py
10 | Author: canhetingsky
11 | Date: 2023/2/19 10:00
12 | cron: 0 30 8 * * *
13 | new Env('阿里云盘4月自动签到');
14 | '''
15 | import sys
16 | import notify
17 | import os
18 | import traceback
19 | import requests
20 | from loguru import logger
21 | SIGN_LOG = 'logs/aliyunpan_sign.log'
22 |
23 | logger.remove()
24 | logger.add(sys.stdout, level='INFO')
25 |
26 | work_path = os.path.dirname(os.path.abspath(__file__))
27 | SIGN_LOG_FILE = os.path.join(work_path, SIGN_LOG)
28 | logger.add(SIGN_LOG_FILE, encoding='utf8')
29 |
30 | # 请在阿里云盘网页端获取:JSON.parse(localStorage.getItem("token")).refresh_token
31 | refresh_token = ""
32 | if refresh_token is None:
33 | logger.error("请先在环境变量里添加阿里云盘的refresh_token")
34 | exit(0)
35 |
36 | def post_msg(url: str, data: dict) -> bool:
37 | response = requests.post(url, data=data)
38 | code = response.status_code
39 | if code == 200:
40 | return True
41 | else:
42 | return False
43 |
44 | def get_access_token(token):
45 | access_token = ''
46 | try:
47 | url = "https://auth.aliyundrive.com/v2/account/token"
48 |
49 | data_dict = {
50 | "refresh_token": token,
51 | "grant_type": "refresh_token"
52 | }
53 | headers = {
54 | "accept": "application/json, text/plain, */*",
55 | "accept-language": "zh-CN,zh;q=0.9",
56 | "cache-control": "no-cache",
57 | "content-type": "application/json;charset=UTF-8",
58 | "origin": "https://www.aliyundrive.com",
59 | "pragma": "no-cache",
60 | "referer": "https://www.aliyundrive.com/",
61 | "sec-fetch-dest": "empty",
62 | "sec-fetch-mode": "cors",
63 | "sec-fetch-site": "same-site",
64 | "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
65 | }
66 |
67 | resp = requests.post(url, json=data_dict, headers=headers)
68 | resp_json = resp.json()
69 | logger.debug(f"resp_json={resp_json}")
70 |
71 | token = {}
72 | token['access_token'] = resp_json.get('access_token', "")
73 | token['refresh_token'] = resp_json.get('refresh_token', "")
74 | token['expire_time'] = resp_json.get('expire_time', "")
75 | logger.info(
76 | f"获取得到新的access_token={token['access_token'][:10]}......,新的refresh_token={token['refresh_token']},过期时间={token['expire_time']}")
77 | access_token = token['access_token']
78 | except:
79 | logger.error(f"获取异常:{traceback.format_exc()}")
80 |
81 | return access_token
82 |
83 |
84 | class ALiYunPan(object):
85 | def __init__(self, access_token):
86 | # 获取JSON.parse(localStorage.getItem("token")).access_token
87 | # 请自行更新填写access_token,有效期7200s
88 | self.access_token = access_token
89 |
90 | def sign_in(self):
91 | sign_in_days_lists = []
92 | not_sign_in_days_lists = []
93 |
94 | try:
95 | token = self.access_token
96 | url = 'https://member.aliyundrive.com/v1/activity/sign_in_list'
97 | headers = {
98 | "Content-Type": "application/json",
99 | "Authorization": token,
100 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 D/C501C6D2-FAF6-4DA8-B65B-7B8B392901EB"
101 | }
102 | body = {}
103 |
104 | resp = requests.post(url, json=body, headers=headers)
105 | resp_text = resp.text
106 | resp_json = resp.json()
107 |
108 | # 未登录
109 | # {"code":"AccessTokenInvalid","message":"not login","requestId":"0a0080e216757311048316214ed958"}
110 | code = resp_json.get('code', '')
111 | if code == "AccessTokenInvalid":
112 | logger.warning(f"请检查token是否正确")
113 | elif code is None:
114 | # success = resp_json.get('success', '')
115 | # logger.debug(f"success={success}")
116 |
117 | result = resp_json.get('result', {})
118 | sign_in_logs_list = result.get("signInLogs", [])
119 | sign_in_count = result.get("signInCount", 0)
120 | title = '阿里云盘签到提醒'
121 | msg = ''
122 |
123 | if len(sign_in_logs_list) > 0:
124 | for i, sign_in_logs_dict in enumerate(sign_in_logs_list, 1):
125 |
126 | status = sign_in_logs_dict.get('status', '')
127 | day = sign_in_logs_dict.get('day', '')
128 | isReward = sign_in_logs_dict.get('isReward', 'false')
129 | if status == "":
130 | logger.info(
131 | f"sign_in_logs_dict={sign_in_logs_dict}")
132 | logger.error(f"签到信息获取异常:{resp_text}")
133 | elif status == "miss":
134 | # logger.warning(f"第{day}天未打卡")
135 | not_sign_in_days_lists.append(day)
136 | elif status == "normal":
137 | reward = {}
138 | if not isReward: # 签到但未领取奖励
139 | reward = self.get_reward(day)
140 | else:
141 | reward = sign_in_logs_dict.get('reward', {})
142 | # 获取签到奖励内容
143 | if reward:
144 | name = reward.get('name', '')
145 | description = reward.get('description', '')
146 | else:
147 | name = '无奖励'
148 | description = ''
149 | today_info = '✅' if day == sign_in_count else '☑'
150 | log_info = f"{today_info}打卡第{day}天,获得奖励:**[{name}->{description}]**"
151 | logger.info(log_info)
152 | msg = log_info + '\n\n' + msg
153 | sign_in_days_lists.append(day)
154 |
155 | log_info = f"🔥打卡进度:{sign_in_count}/{len(sign_in_logs_list)}"
156 | logger.info(log_info)
157 |
158 | msg = log_info + '\n\n' + msg
159 | notify.send(title, msg)
160 | else:
161 | logger.warning(f"resp_json={resp_json}")
162 | else:
163 | logger.warning(f"resp_json={resp_json}")
164 | # logger.debug(f"code={code}")
165 |
166 | except:
167 | logger.error(f"签到异常={traceback.format_exc()}")
168 |
169 | def get_reward(self, day):
170 | try:
171 | token = self.access_token
172 | url = 'https://member.aliyundrive.com/v1/activity/sign_in_reward'
173 | headers = {
174 | "Content-Type": "application/json",
175 | "Authorization": token,
176 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 D/C501C6D2-FAF6-4DA8-B65B-7B8B392901EB"
177 | }
178 | body = {
179 | 'signInDay': day
180 | }
181 |
182 | resp = requests.post(url, json=body, headers=headers)
183 | resp_text = resp.text
184 | logger.debug(f"resp_json={resp_text}")
185 |
186 | resp_json = resp.json()
187 | result = resp_json.get('result', {})
188 | name = result.get('name', '')
189 | description = result.get('description', '')
190 | return {'name': name, 'description': description}
191 | except:
192 | logger.error(f"获取签到奖励异常={traceback.format_exc()}")
193 |
194 | return {'name': 'null', 'description': 'null'}
195 |
196 |
197 | def main():
198 | if ',' in refresh_token:
199 | tokens = refresh_token.split(',')
200 | elif ',' in refresh_token:
201 | tokens = refresh_token.split(',')
202 | else:
203 | tokens = [refresh_token]
204 | for token in tokens:
205 | access_token = get_access_token(token)
206 | if access_token:
207 | ali = ALiYunPan(access_token)
208 | ali.sign_in()
209 |
210 |
211 | if __name__ == '__main__':
212 | main()
213 |
--------------------------------------------------------------------------------
/ym/twkj.js:
--------------------------------------------------------------------------------
1 | /*
2 | @jzack
3 |
4 | 天问科技-7日打卡【微信小程序】
5 |
6 | 赚钱天天乐 同一家得 满一元 提现秒到支付宝 【仅写了签到和查余额】后续补充提现
7 | cron "29 16 * * *" tag=天问科技-7日打卡
8 | 抓包 taokeout.jutuike.com 域名header 里面XX-Token 的值 多账户 @ 或者 回车 分开
9 |
10 | 数据填入 TWtoken 变量里面
11 |
12 | 定时一天一次
13 | */
14 | const $ = new Env("天问科技-7日打卡");
15 | let envSplitor = ['@', '\n']
16 | let result, resurq, resurp, abcd = [], ooOoo = [], oOoo = 0, userCount = 0, OooOo = 'TWtoken'
17 | let userCookie = ($.isNode() ? process.env[OooOo] : $.getdata(OooOo)) || '';
18 | ///////////////////////////////////////////////////////////////////
19 | const _0x4bc5fc=_0x3c70;function _0x166e(){const _0x95c39=['\x69\x6f\x6e\x3d\x33\x2e\x34\x2e\x39\x26','\x61\x63\x30\x61\x38\x35\x35','\x61\x70\x70\x69\x64\x3d\x77\x78\x30\x66','\x36\x65\x34\x62\x63\x35\x65\x36\x61\x37','\x66\x62\x61\x63\x37\x32\x61\x61\x32\x37','\x73\x69\x67\x6e\x3d\x66\x65\x33\x34\x36','\x31\x30\x34\x38\x32\x34\x39\x30\x77\x68\x69\x55\x63\x4e','\x31\x38\x39\x6f\x6b\x44\x5a\x52\x75','\x31\x32\x34\x38\x32\x39\x34\x47\x78\x56\x69\x50\x74','\x32\x33\x31\x38\x36\x39\x39\x39\x59\x77\x46\x50\x67\x43','\x38\x37\x49\x51\x46\x71\x6f\x71','\x37\x70\x44\x61\x6a\x78\x67','\x38\x34\x38\x34\x34\x65\x48\x78\x73\x62\x72','\x33\x33\x30\x32\x50\x43\x51\x50\x67\x4f','\x32\x38\x38\x37\x32\x38\x48\x76\x6e\x72\x4b\x42','\x33\x33\x35\x39\x39\x35\x30\x58\x65\x52\x41\x62\x6e','\x38\x30\x74\x49\x77\x48\x54\x7a'];_0x166e=function(){return _0x95c39;};return _0x166e();}function _0x3c70(_0x5d1e5c,_0x406c5a){const _0xb273d2=_0x166e();return _0x3c70=function(_0x3365ca,_0x351222){_0x3365ca=_0x3365ca-(0x217e+0x1*0x250d+-0x1b1*0x29);let _0x48c14a=_0xb273d2[_0x3365ca];return _0x48c14a;},_0x3c70(_0x5d1e5c,_0x406c5a);}(function(_0x2176e1,_0xa2ca){const _0x23fbaf=_0x3c70,_0x210ffc=_0x2176e1();while(!![]){try{const _0x44a37c=-parseInt(_0x23fbaf(0x141))/(0x2*0x694+0xabc*0x3+-0x2d5b)*(-parseInt(_0x23fbaf(0x133))/(-0xec9+0x1a0c+-0x1*0xb41))+parseInt(_0x23fbaf(0x13e))/(-0x1*0x177f+0xb11+-0x27d*-0x5)*(parseInt(_0x23fbaf(0x140))/(-0x1*0x156b+-0x87a+0x1de9))+-parseInt(_0x23fbaf(0x132))/(0xce*0x26+-0xd0c+0x1183*-0x1)+parseInt(_0x23fbaf(0x13c))/(0x103b+-0x18f+-0x32*0x4b)*(parseInt(_0x23fbaf(0x13f))/(0xbb8+0x71*-0x8+-0x829))+-parseInt(_0x23fbaf(0x142))/(0x17*-0x8+-0x1*0x1bc5+-0x31*-0x95)*(parseInt(_0x23fbaf(0x13b))/(-0x1*-0x416+0x1490+-0x189d))+-parseInt(_0x23fbaf(0x13a))/(-0x67*0x3+-0x321+0x460)+parseInt(_0x23fbaf(0x13d))/(-0x838+-0x160a+0x1e4d);if(_0x44a37c===_0xa2ca)break;else _0x210ffc['push'](_0x210ffc['shift']());}catch(_0x8aa09c){_0x210ffc['push'](_0x210ffc['shift']());}}}(_0x166e,-0xd99*-0x97+0x7b16e+0x2*-0x364bf));let o0O=_0x4bc5fc(0x136)+_0x4bc5fc(0x137)+'\x64\x32\x30\x64\x26\x64\x65\x76\x69\x63'+'\x65\x3d\x78\x63\x78\x26\x76\x65\x72\x73'+_0x4bc5fc(0x134)+_0x4bc5fc(0x139)+_0x4bc5fc(0x138)+'\x61\x64\x63\x39\x35\x65\x66\x34\x63\x62'+_0x4bc5fc(0x135);
20 | class UserInfo {constructor(str) {this.ooo = ++oOoo, this.ooO = `账号 [${this.ooo}] `, this.Ooo=str}
21 | async OoO() {await this.Oo()}
22 | async oOo() {await httpRequest('post', popu(`https://taokeout.jutuike.com/Profit/myProfit`, await this._o(), o0O))
23 | if (resurp.statusCode==200)
24 | result.code==1&&console.log(`${this.ooO}总收益 [${result.data.accumulate_proft}] 余额 [${result.data.balance}]`)}
25 | async oO() {await httpRequest('post', popu(`https://taokeout.jutuike.com/punch/punchTheClock`, await this._o(), o0O))
26 | if (resurp.statusCode==200)
27 | result.code==1&&console.log(`${this.ooO}${result.msg} 已打卡[${result.data.counter}]天`)}
28 | async Oo() {await this.oOo(),await this.oO()}
29 | async _o() {return this.h={"Accept-Encoding":"gzip,compress,br,deflate","Content-Type":"application/x-www-form-urlencoded",Connection:"keep-alive",Referer:"https://servicewechat.com/wx0f6e4bc5e6a7d20d/2/page-frame.html",Host:"taokeout.jutuike.com","User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.20(0x18001442) NetType/WIFI Language/zh_CN","XX-Token":this.Ooo};}
30 | }(async()=>{if(await checkEnv()){for(let a of ooOoo)abcd.push(a.OoO());await Promise.all(abcd)}})().catch(a=>console.log(a)).finally(()=>$.done());
31 | async function checkEnv(){if(userCookie){let e=envSplitor[0];for(let f of envSplitor)if(userCookie.indexOf(f)>-1){e=f;break}for(let l of userCookie.split(e))l&&ooOoo.push(new UserInfo(l));userCount=ooOoo.length}else console.log(`查询[${OooOo}]变量`);return console.log(`找到 ${userCount}个账号`),!0}
32 | function popu(e,t,n=""){e.replace("//","/").split("/")[1];let l={url:e,headers:t,timeout:12e3};return n&&(l.body=n,l.headers["Content-Length"]=n?.length||0),l}async function httpRequest(e,t){return result=null,resurq=null,resurp=null,new Promise(n=>{$.send(e,t,async(e,t,l)=>{try{if(resurq=t,resurp=l,e);else if(l.body){if("object"==typeof l.body)result=l.body;else try{result=JSON.parse(l.body)}catch(o){result=l.body}}}catch(y){console.log(y)}finally{n()}})})}
33 | function Env(e,s){return"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0),new class{constructor(e,s){this.name=e,this.notifyStr="",this.startTime=(new Date).getTime(),Object.assign(this,s),console.log(`${this.name} 开始运行:
34 | `)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}getdata(e){let s=this.getval(e);if(/^@/.test(e)){let[,i,n]=/^@(.*?)\.(.*?)$/.exec(e),r=i?this.getval(i):"";if(r)try{let o=JSON.parse(r);s=o?this.lodash_get(o,n,""):s}catch(a){s=""}}return s}setdata(e,s){let i=!1;if(/^@/.test(s)){let[,n,r]=/^@(.*?)\.(.*?)$/.exec(s),o=this.getval(n);try{let a=JSON.parse(n?"null"===o?null:o||"{}":"{}");this.lodash_set(a,r,e),i=this.setval(JSON.stringify(a),n)}catch(l){let h={};this.lodash_set(h,r,e),i=this.setval(JSON.stringify(h),n)}}else i=this.setval(e,s);return i}getval(e){return this.isSurge()||this.isLoon()?$persistentStore.read(e):this.isQuanX()?$prefs.valueForKey(e):this.isNode()?(this.data=this.loaddata(),this.data[e]):this.data&&this.data[e]||null}setval(e,s){return this.isSurge()||this.isLoon()?$persistentStore.write(e,s):this.isQuanX()?$prefs.setValueForKey(e,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=e,this.writedata(),!0):this.data&&this.data[s]||null}send(e,s,i=()=>{}){if("get"!=e&&"post"!=e&&"put"!=e&&"delete"!=e){console.log(`无效的http方法:${e}`);return}if("get"==e&&s.headers?(delete s.headers["Content-Type"],delete s.headers["Content-Length"]):s.body&&s.headers&&(s.headers["Content-Type"]||(s.headers["Content-Type"]="application/x-www-form-urlencoded")),this.isSurge()||this.isLoon()){this.isSurge()&&this.isNeedRewrite&&(s.headers=s.headers||{},Object.assign(s.headers,{"X-Surge-Skip-Scripting":!1}));let n={method:e,url:s.url,headers:s.headers,timeout:s.timeout,data:s.body};"get"==e&&delete n.data,$axios(n).then(e=>{let{status:s,request:n,headers:r,data:o}=e;i(null,n,{statusCode:s,headers:r,body:o})}).catch(e=>console.log(e))}else if(this.isQuanX())s.method=e.toUpperCase(),this.isNeedRewrite&&(s.opts=s.opts||{},Object.assign(s.opts,{hints:!1})),$task.fetch(s).then(e=>{let{statusCode:s,request:n,headers:r,body:o}=e;i(null,n,{statusCode:s,headers:r,body:o})},e=>i(e));else if(this.isNode()){this.got=this.got?this.got:require("got");let{url:r,...o}=s;this.instance=this.got.extend({followRedirect:!1}),this.instance[e](r,o).then(e=>{let{statusCode:s,request:n,headers:r,body:o}=e;i(null,n,{statusCode:s,headers:r,body:o})},e=>{let{message:s,response:n}=e;i(s,n,n&&n.body)})}}time(e){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"h+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};for(let i in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length))),s)RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e}async showmsg(){if(!this.notifyStr)return;let e=this.name+" 运行通知\n\n"+this.notifyStr;if($.isNode()){var s=require("./sendNotify");console.log("\n============== 推送 =============="),await s.sendNotify(this.name,e)}else this.msg(e)}logAndNotify(e){console.log(e),this.notifyStr+=e,this.notifyStr+="\n"}msg(e=t,s="",i="",n){let r=e=>{if(!e)return e;if("string"==typeof e)return this.isLoon()?e:this.isQuanX()?{"open-url":e}:this.isSurge()?{url:e}:void 0;if("object"==typeof e){if(this.isLoon()){let s;return{openUrl:e.openUrl||e.url||e["open-url"],mediaUrl:e.mediaUrl||e["media-url"]}}if(this.isQuanX()){let i;return{"open-url":e["open-url"]||e.url||e.openUrl,"media-url":e["media-url"]||e.mediaUrl}}if(this.isSurge())return{url:e.url||e.openUrl||e["open-url"]}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,r(n)):this.isQuanX()&&$notify(e,s,i,r(n)));let o=["","============== 系统通知 =============="];o.push(e),s&&o.push(s),i&&o.push(i),console.log(o.join("\n"))}getMin(e,s){return en.length?s-n.length:0,o="";for(let a=0;asetTimeout(s,e))}done(e={}){let s=((new Date).getTime()-this.startTime)/1e3;console.log(`
35 | ${this。name} 运行结束,共运行了 ${s} 秒!`),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(e)}}(e,s)}
36 |
--------------------------------------------------------------------------------
/ym/燕京啤酒.js:
--------------------------------------------------------------------------------
1 | /*
2 | 微信小程序:燕京啤酒小程序官方旗舰店
3 | 功能:签到得积分,兑实物
4 | 变量名:yjpjck,随便找一个请求是https://h5.youzan.com的,找到请求头,取请求头里面Extra-Data里的sid和uuid,总#链接,多账号@隔开
5 | 注意⚠️uuid是一串数字字母组成的,倒数13位是时间戳,不要填进变量!!只要前面部分就可以了。
6 | 比如uuid=FmdMpKAeiknJs6O1670565573439,填进变量的只需要FmdMpKAeiknJs6O
7 | 每天运行一次就好
8 | */
9 | const $ = new Env("燕京啤酒小程序");
10 | let envSplitor = ['@', '\n']
11 | let result, resurq, resurp, abcd = [], userList = [], usid = 0, userCount = 0, OooOo = 'yjpjck'
12 | let userCookie = ($.isNode() ? process.env[OooOo] : $.getdata(OooOo)) || '';
13 | ///////////////////////////////////////////////////////////////////
14 | class UserInfo {
15 | constructor(str) {this._ = ++usid, this.f = `账号 [${this._}] `, this.ck=str.split('#'), this.i=this.ck[0], this.p=this.ck[1]}
16 | async task() {
17 | await this.signin()
18 | await $.wait(2000)
19 | await this.getuserinfo()
20 | }
21 |
22 | async signin() {
23 | this.ts = Math.round(new Date().getTime()).toString();
24 | this.da = `{"is_weapp":1,"sid":"${this.i}","version":"2.117.8.101","client":"weapp","bizEnv":"wsc","uuid":"${this.p}${this.ts}","ftime":${this.ts}}`
25 | this.h = {
26 | 'Accept-Encoding' : `gzip,compress,br,deflate`,
27 | 'content-type' : `application/json`,
28 | 'Connection' : `keep-alive`,
29 | 'Referer' : `https://servicewechat.com/wx4ccbcc233eead2ee/129/page-frame.html`,
30 | 'Host' : `h5.youzan.com`,
31 | 'User-Agent' : `Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.30(0x18001e32) NetType/4G Language/zh_CN`,
32 | 'Extra-Data' : `${this.da}`
33 | }
34 | await httpRequest('get', popu(`https://h5.youzan.com/wscump/checkin/checkinV2.json?checkinId=2299510&app_id=wx6b7c12aaef6cbd9f&kdt_id=107786737`, this.h))
35 | //if (result.code==0){
36 | console.log(`${this.f}签到:${result.msg} `)
37 | //}
38 | }
39 |
40 |
41 | async getuserinfo() {
42 | this.ts = Math.round(new Date().getTime()).toString();
43 | this.da = `{"is_weapp":1,"sid":"${this.i}","version":"2.117.8.101","client":"weapp","bizEnv":"wsc","uuid":"${this.p}${this.ts}","ftime":${this.ts}}`
44 | this.h = {
45 | 'Accept-Encoding' : `gzip,compress,br,deflate`,
46 | 'content-type' : `application/json`,
47 | 'Connection' : `keep-alive`,
48 | 'Referer' : `https://servicewechat.com/wx4ccbcc233eead2ee/129/page-frame.html`,
49 | 'Host' : `h5.youzan.com`,
50 | 'User-Agent' : `Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.30(0x18001e32) NetType/4G Language/zh_CN`,
51 | 'Extra-Data' : `${this.da}`
52 | }
53 | await httpRequest('get', popu(`https://h5.youzan.com/wscuser/membercenter/stats.json?app_id=wx6b7c12aaef6cbd9f&kdt_id=107786737`,this.h))
54 | console.log(`${this.f}已有积分:${result.data.stats.points}`)
55 | }
56 |
57 |
58 |
59 |
60 |
61 | } !(async () => {
62 | if (!(await checkEnv())) return;
63 | for (let user of userList)await user.task()
64 | })()
65 | .catch((e) => console.log(e))
66 | .finally(() => $.done())
67 | function encrypt(e){return CryptoJS.AES.encrypt(e,CryptoJS.enc.Utf8.parse(key),{iv:CryptoJS.enc.Utf8.parse(iv),mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding}).toString()}function decrypt(e){return CryptoJS.AES.decrypt(e,CryptoJS.enc.Utf8.parse(key),{iv:CryptoJS.enc.Utf8.parse(iv),mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding}).toString(CryptoJS.enc.Utf8)}
68 | function MD5Encrypt(_) { function $(_, $) { return _ << $ | _ >>> 32 - $ } function r(_, $) { var r, n, o, t, e; return o = 2147483648 & _, t = 2147483648 & $, r = 1073741824 & _, n = 1073741824 & $, e = (1073741823 & _) + (1073741823 & $), r & n ? 2147483648 ^ e ^ o ^ t : r | n ? 1073741824 & e ? 3221225472 ^ e ^ o ^ t : 1073741824 ^ e ^ o ^ t : e ^ o ^ t } function n(_, n, o, t, e, u, a) { var f, C; return _ = r(_, r(r((f = n) & (C = o) | ~f & t, e), a)), r($(_, u), n) } function o(_, n, o, t, e, u, a) { var f, C, c; return _ = r(_, r(r((f = n, C = o, f & (c = t) | C & ~c), e), a)), r($(_, u), n) } function t(_, n, o, t, e, u, a) { var f, C; return _ = r(_, r(r((f = n) ^ (C = o) ^ t, e), a)), r($(_, u), n) } function e(_, n, o, t, e, u, a) { var f, C; return _ = r(_, r(r((f = n, (C = o) ^ (f | ~t)), e), a)), r($(_, u), n) } function u(_) { var $, r = "", n = ""; for ($ = 0; 3 >= $; $++)r += (n = "0" + (_ >>> 8 * $ & 255).toString(16)).substr(n.length - 2, 2); return r } var a, f, C, c, h, i, v, d, g, m = []; for (m = function (_) { for (var $, r = _.length, n = r + 8, o = 16 * ((n - n % 64) / 64 + 1), t = Array(o - 1), e = 0, u = 0; r > u;)$ = (u - u % 4) / 4, e = u % 4 * 8, t[$] = t[$] | _.charCodeAt(u) << e, u++; return $ = (u - u % 4) / 4, e = u % 4 * 8, t[$] = t[$] | 128 << e, t[o - 2] = r << 3, t[o - 1] = r >>> 29, t }(_ = function (_) { _ = _.replace(/\r\n/g, "\n"); for (var $ = "", r = 0; r < _.length; r++) { var n = _.charCodeAt(r); 128 > n ? $ += String.fromCharCode(n) : n > 127 && 2048 > n ? ($ += String.fromCharCode(n >> 6 | 192), $ += String.fromCharCode(63 & n | 128)) : ($ += String.fromCharCode(n >> 12 | 224), $ += String.fromCharCode(n >> 6 & 63 | 128), $ += String.fromCharCode(63 & n | 128)) } return $ }(_)), i = 1732584193, v = 4023233417, d = 2562383102, g = 271733878, a = 0; a < m.length; a += 16)f = i, C = v, c = d, h = g, i = n(i, v, d, g, m[a + 0], 7, 3614090360), g = n(g, i, v, d, m[a + 1], 12, 3905402710), d = n(d, g, i, v, m[a + 2], 17, 606105819), v = n(v, d, g, i, m[a + 3], 22, 3250441966), i = n(i, v, d, g, m[a + 4], 7, 4118548399), g = n(g, i, v, d, m[a + 5], 12, 1200080426), d = n(d, g, i, v, m[a + 6], 17, 2821735955), v = n(v, d, g, i, m[a + 7], 22, 4249261313), i = n(i, v, d, g, m[a + 8], 7, 1770035416), g = n(g, i, v, d, m[a + 9], 12, 2336552879), d = n(d, g, i, v, m[a + 10], 17, 4294925233), v = n(v, d, g, i, m[a + 11], 22, 2304563134), i = n(i, v, d, g, m[a + 12], 7, 1804603682), g = n(g, i, v, d, m[a + 13], 12, 4254626195), d = n(d, g, i, v, m[a + 14], 17, 2792965006), v = n(v, d, g, i, m[a + 15], 22, 1236535329), i = o(i, v, d, g, m[a + 1], 5, 4129170786), g = o(g, i, v, d, m[a + 6], 9, 3225465664), d = o(d, g, i, v, m[a + 11], 14, 643717713), v = o(v, d, g, i, m[a + 0], 20, 3921069994), i = o(i, v, d, g, m[a + 5], 5, 3593408605), g = o(g, i, v, d, m[a + 10], 9, 38016083), d = o(d, g, i, v, m[a + 15], 14, 3634488961), v = o(v, d, g, i, m[a + 4], 20, 3889429448), i = o(i, v, d, g, m[a + 9], 5, 568446438), g = o(g, i, v, d, m[a + 14], 9, 3275163606), d = o(d, g, i, v, m[a + 3], 14, 4107603335), v = o(v, d, g, i, m[a + 8], 20, 1163531501), i = o(i, v, d, g, m[a + 13], 5, 2850285829), g = o(g, i, v, d, m[a + 2], 9, 4243563512), d = o(d, g, i, v, m[a + 7], 14, 1735328473), v = o(v, d, g, i, m[a + 12], 20, 2368359562), i = t(i, v, d, g, m[a + 5], 4, 4294588738), g = t(g, i, v, d, m[a + 8], 11, 2272392833), d = t(d, g, i, v, m[a + 11], 16, 1839030562), v = t(v, d, g, i, m[a + 14], 23, 4259657740), i = t(i, v, d, g, m[a + 1], 4, 2763975236), g = t(g, i, v, d, m[a + 4], 11, 1272893353), d = t(d, g, i, v, m[a + 7], 16, 4139469664), v = t(v, d, g, i, m[a + 10], 23, 3200236656), i = t(i, v, d, g, m[a + 13], 4, 681279174), g = t(g, i, v, d, m[a + 0], 11, 3936430074), d = t(d, g, i, v, m[a + 3], 16, 3572445317), v = t(v, d, g, i, m[a + 6], 23, 76029189), i = t(i, v, d, g, m[a + 9], 4, 3654602809), g = t(g, i, v, d, m[a + 12], 11, 3873151461), d = t(d, g, i, v, m[a + 15], 16, 530742520), v = t(v, d, g, i, m[a + 2], 23, 3299628645), i = e(i, v, d, g, m[a + 0], 6, 4096336452), g = e(g, i, v, d, m[a + 7], 10, 1126891415), d = e(d, g, i, v, m[a + 14], 15, 2878612391), v = e(v, d, g, i, m[a + 5], 21, 4237533241), i = e(i, v, d, g, m[a + 12], 6, 1700485571), g = e(g, i, v, d, m[a + 3], 10, 2399980690), d = e(d, g, i, v, m[a + 10], 15, 4293915773), v = e(v, d, g, i, m[a + 1], 21, 2240044497), i = e(i, v, d, g, m[a + 8], 6, 1873313359), g = e(g, i, v, d, m[a + 15], 10, 4264355552), d = e(d, g, i, v, m[a + 6], 15, 2734768916), v = e(v, d, g, i, m[a + 13], 21, 1309151649), i = e(i, v, d, g, m[a + 4], 6, 4149444226), g = e(g, i, v, d, m[a + 11], 10, 3174756917), d = e(d, g, i, v, m[a + 2], 15, 718787259), v = e(v, d, g, i, m[a + 9], 21, 3951481745), i = r(i, f), v = r(v, C), d = r(d, c), g = r(g, h); return (u(i) + u(v) + u(d) + u(g)).toLowerCase() }
69 | async function checkEnv(){if(userCookie){let e=envSplitor[0];for(let f of envSplitor)if(userCookie.indexOf(f)>-1){e=f;break}for(let l of userCookie.split(e))l&&userList.push(new UserInfo(l));userCount=userList.length}else console.log(`未找到任何账号`);return console.log(`找到 ${userCount}个账号`),!0}
70 | function popu(e,t,n=""){e.replace("//","/").split("/")[1];let l={url:e,headers:t,timeout:12e3};return n&&(l.body=n,l.headers["Content-Length"]=n?.length||0),l}async function httpRequest(e,t){return result=null,resurq=null,resurp=null,new Promise(n=>{$.send(e,t,async(e,t,l)=>{try{if(resurq=t,resurp=l,e);else if(l.body){if("object"==typeof l.body)result=l.body;else try{result=JSON.parse(l.body)}catch(o){result=l.body}}}catch(y){console.log(y)}finally{n()}})})}
71 | function randomszxx(e) {
72 | e = e || 32;
73 | var t = "qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890",
74 | a = t.length,
75 | n = "";
76 |
77 | for (i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
78 | return n;
79 | }
80 | function Env(e,s){return"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0),new class{constructor(e,s){this.name=e,this.notifyStr="",this.startTime=(new Date).getTime(),Object.assign(this,s),console.log(`${this.name} 开始运行:
81 | `)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}getdata(e){let s=this.getval(e);if(/^@/.test(e)){let[,i,n]=/^@(.*?)\.(.*?)$/.exec(e),r=i?this.getval(i):"";if(r)try{let o=JSON.parse(r);s=o?this.lodash_get(o,n,""):s}catch(a){s=""}}return s}setdata(e,s){let i=!1;if(/^@/.test(s)){let[,n,r]=/^@(.*?)\.(.*?)$/.exec(s),o=this.getval(n);try{let a=JSON.parse(n?"null"===o?null:o||"{}":"{}");this.lodash_set(a,r,e),i=this.setval(JSON.stringify(a),n)}catch(l){let h={};this.lodash_set(h,r,e),i=this.setval(JSON.stringify(h),n)}}else i=this.setval(e,s);return i}getval(e){return this.isSurge()||this.isLoon()?$persistentStore.read(e):this.isQuanX()?$prefs.valueForKey(e):this.isNode()?(this.data=this.loaddata(),this.data[e]):this.data&&this.data[e]||null}setval(e,s){return this.isSurge()||this.isLoon()?$persistentStore.write(e,s):this.isQuanX()?$prefs.setValueForKey(e,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=e,this.writedata(),!0):this.data&&this.data[s]||null}send(e,s,i=()=>{}){if("get"!=e&&"post"!=e&&"put"!=e&&"delete"!=e){console.log(`无效的http方法:${e}`);return}if("get"==e&&s.headers?(delete s.headers["Content-Type"],delete s.headers["Content-Length"]):s.body&&s.headers&&(s.headers["Content-Type"]||(s.headers["Content-Type"]="application/x-www-form-urlencoded")),this.isSurge()||this.isLoon()){this.isSurge()&&this.isNeedRewrite&&(s.headers=s.headers||{},Object.assign(s.headers,{"X-Surge-Skip-Scripting":!1}));let n={method:e,url:s.url,headers:s.headers,timeout:s.timeout,data:s.body};"get"==e&&delete n.data,$axios(n).then(e=>{let{status:s,request:n,headers:r,data:o}=e;i(null,n,{statusCode:s,headers:r,body:o})}).catch(e=>console.log(e))}else if(this.isQuanX())s.method=e.toUpperCase(),this.isNeedRewrite&&(s.opts=s.opts||{},Object.assign(s.opts,{hints:!1})),$task.fetch(s).then(e=>{let{statusCode:s,request:n,headers:r,body:o}=e;i(null,n,{statusCode:s,headers:r,body:o})},e=>i(e));else if(this.isNode()){this.got=this.got?this.got:require("got");let{url:r,...o}=s;this.instance=this.got.extend({followRedirect:!1}),this.instance[e](r,o).then(e=>{let{statusCode:s,request:n,headers:r,body:o}=e;i(null,n,{statusCode:s,headers:r,body:o})},e=>{let{message:s,response:n}=e;i(s,n,n&&n.body)})}}time(e){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"h+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};for(let i in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length))),s)RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[i]:("00"+s[i]).substr((""+s[i]).length)));return e}async showmsg(){if(!this.notifyStr)return;let e=this.name+" 运行通知\n\n"+this.notifyStr;if($.isNode()){var s=require("./sendNotify");console.log("\n============== 推送 =============="),await s.sendNotify(this.name,e)}else this.msg(e)}logAndNotify(e){console.log(e),this.notifyStr+=e,this.notifyStr+="\n"}msg(e=t,s="",i="",n){let r=e=>{if(!e)return e;if("string"==typeof e)return this.isLoon()?e:this.isQuanX()?{"open-url":e}:this.isSurge()?{url:e}:void 0;if("object"==typeof e){if(this.isLoon()){let s;return{openUrl:e.openUrl||e.url||e["open-url"],mediaUrl:e.mediaUrl||e["media-url"]}}if(this.isQuanX()){let i;return{"open-url":e["open-url"]||e.url||e.openUrl,"media-url":e["media-url"]||e.mediaUrl}}if(this.isSurge())return{url:e.url||e.openUrl||e["open-url"]}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,r(n)):this.isQuanX()&&$notify(e,s,i,r(n)));let o=["","============== 系统通知 =============="];o.push(e),s&&o.push(s),i&&o.push(i),console.log(o.join("\n"))}getMin(e,s){return en.length?s-n.length:0,o="";for(let a=0;asetTimeout(s,e))}done(e={}){let s=((new Date).getTime()-this.startTime)/1e3;console.log(`
82 | ${this.name} 运行结束,共运行了 ${s} 秒!`),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(e)}}(e,s)}
83 |
--------------------------------------------------------------------------------
/bak/jd_9.9-6.js:
--------------------------------------------------------------------------------
1 | /*
2 | cron 58 59 9 * * *
3 | */
4 |
5 | const $ = new Env('抢极速版全品卷');
6 | const moment = require('moment');
7 | //进容器安装依赖: npm install -g moment
8 | const notify = $.isNode() ? require('./sendNotify') : '';
9 | //Node.js用户请在jdCookie.js处填写京东ck;
10 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
11 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
12 | const randomCount = $.isNode() ? 30 : 5;
13 | //IOS等用户直接用NobyDa的jd cookie
14 | let cookiesArr = [], cookie = '', message;
15 | if ($.isNode()) {
16 | Object.keys(jdCookieNode).forEach((item) => {
17 | cookiesArr.push(jdCookieNode[item])
18 | })
19 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
20 | };
21 | } else {
22 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
23 | }
24 | const JD_API_HOST = 'https://api.m.jd.com/client.action?';
25 | let wait = ms => new Promise(resolve => setTimeout(resolve, ms));
26 | !(async () => {
27 | if (!cookiesArr[0]) {
28 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
29 | return;
30 | }
31 | await wait(100)
32 | for (let j = 0; j < randomCount; ++j)
33 | for (let i = 0; i < 7; i++) {
34 | if (cookiesArr[i]) {
35 | cookie = cookiesArr[i];
36 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
37 | $.index = i + 1;
38 | console.log(`*********京东账号${$.index} ${$.UserName}*********`)
39 | $.isLogin = true;
40 | $.nickName = '';
41 | message = '';
42 | await qiang();
43 | }
44 | }
45 | })()
46 | .catch((e) => {
47 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
48 | })
49 | .finally(() => {
50 | $.done();
51 | })
52 |
53 | async function qiang() {
54 | await exchange()
55 | }
56 |
57 | function exchange() {
58 | return new Promise(resolve => {
59 | $.post(taskUrl('functionId=lite_newBabelAwardCollection'), (err, resp, data) => {
60 | try {
61 | if (err) {
62 | console.log(`${JSON.stringify(err)}`)
63 | console.log(`${$.name} user/exchange/bean API请求失败,请检查网路重试\n`)
64 | } else {
65 | console.log(moment().format("YYYY-MM-DD HH:mm:ss.SSS"));
66 | console.log(data);
67 | if (safeGet(data)) {
68 | data = JSON.parse(data);
69 | console.log(`抢券结果:${JSON.stringify(data)}\n`)
70 | }
71 | }
72 | } catch (e) {
73 | $.logErr(e, resp)
74 | } finally {
75 | resolve();
76 | }
77 | })
78 | })
79 | }
80 |
81 | function taskUrl(function_id, body = {}) {
82 | return {
83 | url: `https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection`,
84 | headers: {
85 | "Accept": "*/*",
86 | "Accept-Encoding": "gzip, deflate, br",
87 | "Accept-Language": "zh-cn",
88 | "Connection": "keep-alive",
89 | "Content-Type": "application/x-www-form-urlencoded",
90 | 'origin': 'https://pro.m.jd.com',
91 | "Referer": "https://pro.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?lng=106.476617&lat=29.502674&sid=fbc43764317f538b90e0f9ab43c8285w&un_area=4_50952_106_0",
92 | "Cookie": cookie,
93 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
94 | },
95 | body: "https%3A%2F%2Fapi.m.jd.com%2Fclient.action%3FfunctionId%3DnewBabelAwardCollection%26client%3Dwh5%26body%3D%7B%22activityId%22%3A%223H885vA4sQj6ctYzzPVix4iiYN2P%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3DDE0D4055A7177661AFE7665B21D4E5BD3C77419B4D58A36B71F75F46E96856D8270B7F9DAEE7922F7017CD82E1E1B483_bingo%2CroleId%3DFBFCA24892286E5ED792986756046832_bingo%2CstrengthenKey%3DAFB364F839D6091AB7F7D2D173E166F38BE2C1F6772A95D1AA534CC8FBDC7179F5F390645E06276B2E3106610EAE0A32_bingo%22%7D"
96 | }
97 | }
98 |
99 | function TotalBean() {
100 | return new Promise(async resolve => {
101 | const options = {
102 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
103 | "headers": {
104 | "Accept": "application/json,text/plain, */*",
105 | "Content-Type": "application/x-www-form-urlencoded",
106 | "Accept-Encoding": "gzip, deflate, br",
107 | "Accept-Language": "zh-cn",
108 | "Connection": "keep-alive",
109 | "Cookie": cookie,
110 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
111 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
112 | }
113 | }
114 | $.post(options, (err, resp, data) => {
115 | try {
116 | if (err) {
117 | console.log(`${JSON.stringify(err)}`)
118 | console.log(`${$.name} API请求失败,请检查网路重试`)
119 | } else {
120 | if (data) {
121 | data = JSON.parse(data);
122 | if (data['retcode'] === 13) {
123 | $.isLogin = false; //cookie过期
124 | return
125 | }
126 | if (data['retcode'] === 0) {
127 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
128 | } else {
129 | $.nickName = $.UserName
130 | }
131 | } else {
132 | console.log(`京东服务器返回空数据`)
133 | }
134 | }
135 | } catch (e) {
136 | $.logErr(e, resp)
137 | } finally {
138 | resolve();
139 | }
140 | })
141 | })
142 | }
143 |
144 | function safeGet(data) {
145 | try {
146 | if (typeof JSON.parse(data) == "object") {
147 | return true;
148 | }
149 | } catch (e) {
150 | console.log(e);
151 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
152 | return false;
153 | }
154 | }
155 | function jsonParse(str) {
156 | if (typeof str == "string") {
157 | try {
158 | return JSON.parse(str);
159 | } catch (e) {
160 | console.log(e);
161 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
162 | return [];
163 | }
164 | }
165 | }
166 | // prettier-ignore
167 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
168 |
--------------------------------------------------------------------------------
/ym/ttl.js:
--------------------------------------------------------------------------------
1 | /*
2 | 如需抓token 打开微信小程序 太太乐 餐饮服务 请求头里面token
3 | 或者太太乐APP点我的 登录 logintoken=***这条也行
4 | 多账号@隔开
5 | 如需换话费 下载太太乐餐饮服务APP积分兑换话费
6 | 如果没库存了 自己隔天再看
7 | 优化者:亿慧通
8 | ==========
9 | 青龙变量
10 | ==========
11 | ttlhd='' 多账号@隔开
12 | ==========
13 |
14 | 十一教程网:http://bk.ajouter.cn/
15 | qq交流群:487417175
16 | [task_local]
17 | cron "29 10 * * *" tag=太太乐
18 | */
19 |
20 | const $ = new Env('太太乐');
21 | var request = require("request");
22 | let status;
23 | status = (status = ($.getval("ttlstatus") || "1") ) > 1 ? `${status}` : ""; // 账号扩展字符
24 | let ttlhdArr = [],ttlcount = ''
25 | let ttlhd= $.isNode() ? (process.env.ttlhd ? process.env.ttlhd : "") : ($.getdata('ttlhd') ? $.getdata('ttlhd') : "")
26 |
27 | let ttlhds = ""
28 | const logs =0;
29 | const host='https://www.ttljf.com/ttl_chefHub/'
30 | var hours = new Date().getHours();
31 | var s = new Date().getMinutes();
32 |
33 | var timestamp = Math.round(new Date().getTime()/1000).toString();
34 | !(async () => {
35 | if (typeof $request !== "undefined") {
36 | await ttlck()
37 | } else {
38 | if(!$.isNode()){
39 | ttlhdArr.push($.getdata('ttlhd'))
40 | let ttlcount = ($.getval('ttlcount') || '1');
41 | for (let i = 2; i <= ttlcount; i++) {
42 | ttlhdArr.push($.getdata(`ttlhd${i}`))
43 | }
44 | console.log(`------------- 共${ttlhdArr.length}个账号-------------\n`)
45 | for (let i = 0; i < ttlhdArr.length; i++) {
46 | if (ttlhdArr[i]) {
47 | ttlhd = ttlhdArr[i];
48 | $.index = i + 1;
49 |
50 | console.log(`\n开始【太太乐${$.index}】`)
51 | console.log(`第一次注册必须先登录一次小程序绑定微信然后用接口\n不会抓包的手残智力障碍的接口获取token\nhttp://47.101.146.160/ttl.php?zh=手机号码&mm=密码\n如需换话费 下载太太乐APP积分兑换话费\n如果没库存了 自己隔天再看`)
52 |
53 | await sign()
54 | await blog()
55 | await my()
56 | }
57 | }
58 | }else {
59 | if (process.env.ttlhd && process.env.ttlhd.indexOf('@') > -1) {
60 | ttlhdArr = process.env.ttlhd.split('@');
61 | console.log(`您选择的是用"@"隔开\n`)
62 | } else {
63 | ttlhds = [process.env.ttlhd]
64 | };
65 | Object.keys(ttlhds).forEach((item) => {
66 | if (ttlhds[item]) {
67 | ttlhdArr.push(ttlhds[item])
68 | }
69 | })
70 | console.log(`共${ttlhdArr.length}个cookie`)
71 | for (let k = 0; k < ttlhdArr.length; k++) {
72 | $.message = ""
73 | ttlhd = ttlhdArr[k]
74 | $.index = k + 1;
75 |
76 | console.log(`\n开始【太太乐${$.index}】`)
77 | console.log(`第一次注册必须先登录一次小程序绑定微信然后用接口\n不会抓包的手残智力障碍的接口获取token\nhttp://47.101.146.160/ttl.php?zh=手机号码&mm=密码\n如需换话费 下载太太乐APP积分兑换话费\n如果没库存了 自己隔天再看`)
78 | await kcjk(633)
79 | await kcjk(631)
80 | await kcjk(62)
81 | await kcjk(61)
82 | await sign()
83 | await blog()
84 | await my()
85 | }
86 |
87 |
88 | }
89 | }
90 | })()
91 | .catch((e) => $.logErr(e))
92 | .finally(() => $.done())
93 |
94 |
95 | function ttlck() {
96 | if ($request.url.indexOf("user") > -1) {
97 | const ttlhd = $request.url
98 |
99 | if(ttlhd) $.setdata(ttlhd,`ttlhd${status}`)
100 |
101 |
102 | $.log(ttlhd)
103 | ttlhd = ttlhd.match(/loginToken=(.*?)&/)[1]
104 | $.log(ttlhd)
105 | $.msg($.name,"",'太太乐'+`${status}` +'数据获取成功!')
106 |
107 | }
108 | }
109 | async function kcjk(giftId){
110 | return new Promise((resolve) => {
111 |
112 | let nm = {
113 | url: `https://www.ttljf.com/ttl_site/giftApi.do?giftId=${giftId}&mthd=giftDetail&sign=569aeaef6da7470ae38e4907aab980da&userId=`,
114 | headers:{
115 | 'User-Agent':' Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
116 |
117 | }
118 | }
119 | $.get(nm,async(error, response, data) =>{
120 |
121 | try{
122 | aa = data.match(/{"code":"0000","message":"成功","url":".*","gifts":{"brand":"","collectId":0,"description":"/)
123 | bb= data.match(/","exchangeLimit":.+/)
124 | cc=aa+bb
125 |
126 |
127 | const result = JSON.parse(cc)
128 | $.msg(`${result.gifts.giftName} 需要积分:${result.gifts.price} 库存:${result.gifts.stockAmount}`)
129 | //$.log(`${result.gifts.giftName} 需要积分:${result.gifts.price} 库存:${result.gifts.stockAmount}`)
130 | }catch(e) {
131 | $.logErr(e, response);
132 | } finally {
133 | resolve();
134 | }
135 | })
136 | })
137 | }
138 |
139 | async function dx(){
140 | return new Promise((resolve) => {
141 |
142 | let nm = {
143 | url: 'https://www.ttljf.com/ttl_site/giftApi.do?giftId=633&mthd=giftDetail&sign=569aeaef6da7470ae38e4907aab980da&userId=',
144 | headers:{
145 | 'User-Agent':' Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
146 |
147 | }
148 | }
149 | $.get(nm,async(error, response, data) =>{
150 | //$.log(data)
151 | try{
152 | aa = data.match(/{"code":"0000","message":"成功","url":".*","gifts":{"brand":"","collectId":0,"description":"/)
153 | bb= data.match(/","exchangeLimit":.+/)
154 | cc=aa+bb
155 |
156 | $.log(cc)
157 | const result = JSON.parse(cc)
158 |
159 | //$.log(result.gifts.giftName+' 需要积分:'result.gifts.price+' 库存:'+result.gifts.stockAmount)
160 | }catch(e) {
161 | $.logErr(e, response);
162 | } finally {
163 | resolve();
164 | }
165 | })
166 | })
167 | }
168 |
169 |
170 |
171 | async function blog(){
172 | return new Promise((resolve) => {
173 | setTimeout(function(){
174 | body = {"id":"A35D575F-C004-4717-AABC-ED9D1979C3FA","type":"blog"}
175 | request.put(ttl('Common/share/A35D575F-C004-4717-AABC-ED9D1979C3FA/blog',body), function(error, response, body) {
176 | try {
177 | if (error) {
178 | console.log(`${JSON.stringify(err)}`)
179 | console.log(`${$.name} API请求失败,请检查网路重试`)
180 | }
181 |
182 | data = JSON.parse(body);
183 | if(data.code==0){
184 | console.log('\n分享任务:'+data.message)
185 |
186 | }else
187 | if(data.code!=0){
188 | console.log('\n分享任务:'+data.message)
189 |
190 | }
191 | }catch (e) {
192 | $.logErr(e, resp)
193 | } finally {
194 | resolve(data);
195 | }
196 | });
197 | },5000)
198 | })
199 | }
200 |
201 | async function sign(){
202 | return new Promise((resolve) => {
203 | setTimeout(function(){
204 | request.put(ttl('user/api/sign/today',''), function(error, response, body) {
205 | try {
206 | if (error) {
207 | console.log(`${JSON.stringify(err)}`)
208 | console.log(`${$.name} API请求失败,请检查网路重试`)
209 | }
210 |
211 |
212 |
213 | data = JSON.parse(body);
214 | if(data.code==0){
215 | console.log('\n签到任务:'+data.message)
216 |
217 | }else
218 | if(data.code!=0){
219 | console.log('\n签到任务:'+data.message)
220 |
221 | }
222 | }catch (e) {
223 | $.logErr(e, resp)
224 | } finally {
225 | resolve(data);
226 | }
227 | });
228 | },5000)
229 | })
230 | }
231 | function my() {
232 | return new Promise((resolve) => {
233 |
234 | $.get(ttlget('user/api/my'), async (err, resp, data) => {
235 | setTimeout(function(){
236 | try {
237 | if (err) {
238 | console.log(`${JSON.stringify(err)}`)
239 | console.log(`${$.name} API请求失败,请检查网路重试`)
240 | }// else {
241 | if (safeGet(data)) {
242 | data = JSON.parse(data);
243 | if(data.code==0){
244 | console.log('\n积分:'+data.data.integral)
245 |
246 |
247 | }
248 | }else if(data.code!=0){
249 | console.log(data.message)
250 |
251 | }
252 | //}
253 |
254 | } catch (e) {
255 | $.logErr(e, resp)
256 | } finally {
257 | resolve(data);
258 | }
259 | },5000)
260 | })
261 | })
262 | }
263 |
264 |
265 | function ttl(a,body) {
266 | return {
267 |
268 | url: `${host}${a}`,
269 | body:`${body}`,
270 | headers: {
271 | 'Host': 'www.ttljf.com',
272 | 'Accept': 'application/json, text/plain, */*',
273 | 'content-type': 'application/json',
274 | 'token': ttlhd,
275 | 'X-Requested-With': 'XMLHttpRequest',
276 | 'Accept-Encoding': 'gzip,compress,br,deflate',
277 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.14(0x18000e2f) NetType/4G Language/zh_CN',
278 | 'Referer': 'https://servicewechat.com/wxe9aa8f1c4a77ddf5/17/page-frame.html' ,
279 |
280 | }
281 | }
282 | }
283 | function ttlget(a) {
284 | return {
285 |
286 | url: `${host}${a}`,
287 | headers: {
288 | 'Host': 'www.ttljf.com',
289 | 'Accept': 'application/json, text/plain, */*',
290 | 'content-type': 'application/json',
291 | 'token': ttlhd,
292 | 'X-Requested-With': 'XMLHttpRequest',
293 | 'Accept-Encoding': 'gzip,compress,br,deflate',
294 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.14(0x18000e2f) NetType/4G Language/zh_CN',
295 | 'Referer': 'https://servicewechat.com/wxe9aa8f1c4a77ddf5/17/page-frame.html' ,
296 |
297 | }
298 | }
299 | }
300 |
301 |
302 |
303 |
304 | function safeGet(data) {
305 | try {
306 | if (typeof JSON.parse(data) == "object") {
307 | return true;
308 | }
309 | } catch (e) {
310 | console.log(e);
311 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
312 | return false;
313 | }
314 | }
315 | function jsonParse(str) {
316 | if (typeof str == "string") {
317 | try {
318 | return JSON.parse(str);
319 | } catch (e) {
320 | console.log(e);
321 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
322 | return [];
323 | }
324 | }
325 | }
326 |
327 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
328 |
--------------------------------------------------------------------------------
/bak/jd_29_8.js:
--------------------------------------------------------------------------------
1 | /*
2 | 极速版抢卷
3 |
4 | ============Quantumultx===============
5 | [task_local]
6 | #极速版抢卷
7 | 58 59 8,11,14,16,19 * * * https://raw.githubusercontent.com/KingRan/KR/main/jd_29_8.js, tag=极速版抢卷, enabled=true
8 | ================Loon==============
9 | [Script]
10 | cron "58 59 8,11,14,16,19 * * *" script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_29_8.js,tag=极速版抢卷
11 | ===============Surge=================
12 | 极速版抢卷 = type=cron,cronexp="58 59 8,11,14,16,19 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_29_8.js
13 | ============小火箭=========
14 | 极速版抢卷 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_29_8.js, cronexpr="58 59 8,11,14,16,19 * * *", timeout=3600, enable=true
15 | */
16 | const $ = new Env('抢极速版全品卷29-8');
17 | const moment = require('moment');
18 | //进容器安装依赖: npm install -g moment
19 | const notify = $.isNode() ? require('./sendNotify') : '';
20 | //Node.js用户请在jdCookie.js处填写京东ck;
21 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
22 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
23 | const randomCount = $.isNode() ? 30 : 5;
24 | //IOS等用户直接用NobyDa的jd cookie
25 | let cookiesArr = [], cookie = '', message;
26 | if ($.isNode()) {
27 | Object.keys(jdCookieNode).forEach((item) => {
28 | cookiesArr.push(jdCookieNode[item])
29 | })
30 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
31 | };
32 | } else {
33 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
34 | }
35 | const JD_API_HOST = 'https://api.m.jd.com/client.action?';
36 | let wait = ms => new Promise(resolve => setTimeout(resolve, ms));
37 | !(async () => {
38 | if (!cookiesArr[0]) {
39 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
40 | return;
41 | }
42 | await wait(100)
43 | for (let j = 0; j < randomCount; ++j)
44 | for (let i = 0; i < 7; i++) {
45 | if (cookiesArr[i]) {
46 | cookie = cookiesArr[i];
47 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
48 | $.index = i + 1;
49 | console.log(`*********京东账号${$.index} ${$.UserName}*********`)
50 | $.isLogin = true;
51 | $.nickName = '';
52 | message = '';
53 | await qiang();
54 | }
55 | }
56 | })()
57 | .catch((e) => {
58 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
59 | })
60 | .finally(() => {
61 | $.done();
62 | })
63 |
64 | async function qiang() {
65 | await exchange()
66 | }
67 |
68 | function exchange() {
69 | return new Promise(resolve => {
70 | $.post(taskUrl('functionId=lite_newBabelAwardCollection'), (err, resp, data) => {
71 | try {
72 | if (err) {
73 | console.log(`${JSON.stringify(err)}`)
74 | console.log(`${$.name} user/exchange/bean API请求失败,请检查网路重试\n`)
75 | } else {
76 | console.log(moment().format("YYYY-MM-DD HH:mm:ss.SSS"));
77 | console.log(data);
78 | if (safeGet(data)) {
79 | data = JSON.parse(data);
80 | console.log(`抢券结果:${JSON.stringify(data)}\n`)
81 | }
82 | }
83 | } catch (e) {
84 | $.logErr(e, resp)
85 | } finally {
86 | resolve();
87 | }
88 | })
89 | })
90 | }
91 |
92 | function taskUrl(function_id, body = {}) {
93 | return {
94 | url: `https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection`,
95 | headers: {
96 | "Accept": "*/*",
97 | "Accept-Encoding": "gzip, deflate, br",
98 | "Accept-Language": "zh-cn",
99 | "Connection": "keep-alive",
100 | "Content-Type": "application/x-www-form-urlencoded",
101 | 'origin': 'https://pro.m.jd.com',
102 | "Referer": "https://pro.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?lng=106.476617&lat=29.502674&sid=fbc43764317f538b90e0f9ab43c8285w&un_area=4_50952_106_0",
103 | "Cookie": cookie,
104 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
105 | },
106 | body: "body=%7B%22activityId%22%3A%223H885vA4sQj6ctYzzPVix4iiYN2P%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3D6102ED3D9BC7C8DFF14D1A36FFA89602070B138DF76D200B6FA411359FBAD50B1FD83787E7C9BEF8843A4631ADF6C792_bingo%2CroleId%3D20E136F5EB78E9D323CEA65000B08718_bingo%2CstrengthenKey%3DB95D6A81ACB1760E33CCD3461D64D27E5446F252C845E06C8CA0282A6B890B8642B9545EFB67025871B4CDDDF16A6514_bingo%22%2C%22platform%22%3A%221%22%2C%22orgType%22%3A%222%22%2C%22openId%22%3A%22-1%22%2C%22pageClickKey%22%3A%22-1%22%2C%22eid%22%3A%22I3Q65STURLZJUNF3MG743ZFJE5XYQDFHRZSCQ5YDS6T4CSPC6RA6MMZMP2IXIYWSNNO6WA5FIY4RIB42XNRSUMMRTU%22%2C%22fp%22%3A%22a82cb7997e7c879cb36b06f5e0574691%22%2C%22shshshfp%22%3A%2232568b7604006026de6f4754706c832e%22%2C%22shshshfpa%22%3A%22f585c87a-29b9-5140-8d32-4534dde58fb9-1609327675%22%2C%22shshshfpb%22%3A%22b0EElfCWaahraD7QwIlrPdQ%22%2C%22childActivityUrl%22%3A%22https%253A%252F%252Fprodev.m.jd.com%252Fjdlite%252Factive%252F3H885vA4sQj6ctYzzPVix4iiYN2P%252Findex.html%253Fsid%253Dff03fc0d68d4ca7443ab37714b04131w%2526un_area%253D4_50952_106_0%22%2C%22userArea%22%3A%22-1%22%2C%22client%22%3A%22-1%22%2C%22clientVersion%22%3A%22-1%22%2C%22uuid%22%3A%22-1%22%2C%22osVersion%22%3A%22-1%22%2C%22brand%22%3A%22-1%22%2C%22model%22%3A%22-1%22%2C%22networkType%22%3A%22-1%22%2C%22jda%22%3A%22123122771.1637222757035542254276.1637222757.1646064174.1646117985.608%22%2C%22sdkToken%22%3A%22%22%2C%22token%22%3A%226ZIWOHGENB6BTQXTEJGZBDLY7MBHBBWZY57SZZCKGLYBXRIUOIZHJ4ZTEAJ3FTZWIC5R2AN2FATZG%22%2C%22jstub%22%3A%22DAAP6BRCQ74QJKGZ6FZ4ECXWDXYP5TM7P4B3DGCISN6NZGXIAQL6ZXUK37FXHLKCIBNCFI7KSSPCTSWKMCHBSIPLOS252WK5XTQWY6Y%22%2C%22pageClick%22%3A%22Babel_Coupon%22%2C%22couponSource%22%3A%22manual%22%2C%22couponSourceDetail%22%3A%22-100%22%2C%22channel%22%3A%22%E9%80%9A%E5%A4%A9%E5%A1%94%E4%BC%9A%E5%9C%BA%22%2C%22headArea%22%3A%22605715ec560d6508f7403b91b677d79c%22%2C%22sceId%22%3A%22TTTh5%22%2C%22rstr%22%3A%2282995177%22%2C%22sstr%22%3A%221646118018577~1EqZYRD82rFMDFYQlRjSDAxMQ%3D%3D.aXRgVXlpemRTfWhzZB07b3syCQtoFgFbNmluY09%2BdHMqUTZpPDZTDR0uMiAfOSM8ESkcdQUUATQwBAcZJg%3D%3D.d0f8b630~6%2C1~CE166D83C4A5E2B2B919D053DB4239DFCF4E5AD3~0xk8nqc~C~ShtGXxQKaWwdG0ZcWxIIahNdAx8EYx5yABV7HkMcRhMdG1YHGwJ4HXILHgMCAh4DHwoEAhpEEB0TXQUfBHoecgMVAwRvHAAfAg8CHkISbx0TXkBcFAoFHRNKQRAMEgMHBQ8DAw4AAwkBCgEHAwkHEx0bRVdSEggTRU1GRkJWR1cTFRBFU1EQCxNfVEZCREZEUBseEEZUXBMLYgEGGgQHAgQVAwoaAQQdABUHbxoSWFsTAwEeFFNBEwsbC1RUBVMEBFoCBwFRUFBSXwYHDgQLAAQAUVZQVgFTUFwQHhReQhMLG35bWEVKEVBYQFFeBgYTHRtGEAwBBAUHCAMKBgEKBAYOHhBcWxALExQfBFIGBVBSAVALBQcEU1JcChAaElRBUxsIEFQAd3RdX3FlV1FaQ1B9BWNBeV5DYV1jEBoSXEcTAxB1WV9VXVQZe1xVHhAdE1dTRBQKEAMDDgQQGhJBUkMbCGkOAAIdAg8CbxoSQF4TA2kQdXRrHHB3CwIUHBBQX11AXV9UEB0TCAIQGhIBHwkXAwAUHBADAw4EEBoSBAIFDwQBAQMDBwIPCgEEBh8IAgoBBQUGAQMHCgQHAAgBEx0bAxBrHBBYXlgQCBRWVFdXX1RGQhIeE1BTEAgURRAdE1pbEAwSRQIfDRwBFBwQUldmRBAMEgIAExUQUFISCBNDWFxWWV0PCQMACwcHBwUTHRtfWBQKaQAdCR4CaxwQU11WVRAMElMTHRtfQVESCBNQG08%3D~1iwtzrn%22%2C%22mitemAddrId%22%3A%22%22%2C%22geo%22%3A%7B%22lng%22%3A%22%22%2C%22lat%22%3A%22%22%7D%2C%22addressId%22%3A%223909001077%22%2C%22posLng%22%3A%22106.476904%22%2C%22posLat%22%3A%2229.502927%22%2C%22focus%22%3A%22%22%2C%22innerAnchor%22%3A%22%22%2C%22cv%22%3A%222.0%22%7D&screen=1080*2145&client=wh5&clientVersion=1.0.0&sid=ff03fc0d68d4ca7443ab37714b04131w&uuid=1637222757035542254276.2314.1646118018243&area=4_50952_106_0"
107 | }
108 | }
109 |
110 | function TotalBean() {
111 | return new Promise(async resolve => {
112 | const options = {
113 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
114 | "headers": {
115 | "Accept": "application/json,text/plain, */*",
116 | "Content-Type": "application/x-www-form-urlencoded",
117 | "Accept-Encoding": "gzip, deflate, br",
118 | "Accept-Language": "zh-cn",
119 | "Connection": "keep-alive",
120 | "Cookie": cookie,
121 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
122 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
123 | }
124 | }
125 | $.post(options, (err, resp, data) => {
126 | try {
127 | if (err) {
128 | console.log(`${JSON.stringify(err)}`)
129 | console.log(`${$.name} API请求失败,请检查网路重试`)
130 | } else {
131 | if (data) {
132 | data = JSON.parse(data);
133 | if (data['retcode'] === 13) {
134 | $.isLogin = false; //cookie过期
135 | return
136 | }
137 | if (data['retcode'] === 0) {
138 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
139 | } else {
140 | $.nickName = $.UserName
141 | }
142 | } else {
143 | console.log(`京东服务器返回空数据`)
144 | }
145 | }
146 | } catch (e) {
147 | $.logErr(e, resp)
148 | } finally {
149 | resolve();
150 | }
151 | })
152 | })
153 | }
154 |
155 | function safeGet(data) {
156 | try {
157 | if (typeof JSON.parse(data) == "object") {
158 | return true;
159 | }
160 | } catch (e) {
161 | console.log(e);
162 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
163 | return false;
164 | }
165 | }
166 | function jsonParse(str) {
167 | if (typeof str == "string") {
168 | try {
169 | return JSON.parse(str);
170 | } catch (e) {
171 | console.log(e);
172 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
173 | return [];
174 | }
175 | }
176 | }
177 | // prettier-ignore
178 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
179 |
--------------------------------------------------------------------------------
/bak/jd_19_6.js:
--------------------------------------------------------------------------------
1 | /*
2 | 极速版抢卷
3 |
4 | ============Quantumultx===============
5 | [task_local]
6 | #极速版抢卷
7 | 58 59 6,9,14,17,20 * * * https://raw.githubusercontent.com/KingRan/KR/main/jd_19_6.js, tag=极速版抢卷, enabled=true
8 | ================Loon==============
9 | [Script]
10 | cron "58 59 6,9,14,17,20 * * *" script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_19_6.js,tag=极速版抢卷
11 | ===============Surge=================
12 | 极速版抢卷 = type=cron,cronexp="58 59 6,9,14,17,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_19_6.js
13 | ============小火箭=========
14 | 极速版抢卷 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_19_6.js, cronexpr="58 59 6,9,14,17,20 * * *", timeout=3600, enable=true
15 | */
16 | const $ = new Env('抢极速版全品卷19-6');
17 | const moment = require('moment');
18 | //进容器安装依赖: npm install -g moment
19 | const notify = $.isNode() ? require('./sendNotify') : '';
20 | //Node.js用户请在jdCookie.js处填写京东ck;
21 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
22 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
23 | const randomCount = $.isNode() ? 30 : 5;
24 | //IOS等用户直接用NobyDa的jd cookie
25 | let cookiesArr = [], cookie = '', message;
26 | if ($.isNode()) {
27 | Object.keys(jdCookieNode).forEach((item) => {
28 | cookiesArr.push(jdCookieNode[item])
29 | })
30 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
31 | };
32 | } else {
33 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
34 | }
35 | const JD_API_HOST = 'https://api.m.jd.com/client.action?';
36 | let wait = ms => new Promise(resolve => setTimeout(resolve, ms));
37 | !(async () => {
38 | if (!cookiesArr[0]) {
39 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
40 | return;
41 | }
42 | await wait(100)
43 | for (let j = 0; j < randomCount; ++j)
44 | for (let i = 0; i < 7; i++) {
45 | if (cookiesArr[i]) {
46 | cookie = cookiesArr[i];
47 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
48 | $.index = i + 1;
49 | console.log(`*********京东账号${$.index} ${$.UserName}*********`)
50 | $.isLogin = true;
51 | $.nickName = '';
52 | message = '';
53 | await qiang();
54 | }
55 | }
56 | })()
57 | .catch((e) => {
58 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
59 | })
60 | .finally(() => {
61 | $.done();
62 | })
63 |
64 | async function qiang() {
65 | await exchange()
66 | }
67 |
68 | function exchange() {
69 | return new Promise(resolve => {
70 | $.post(taskUrl('functionId=lite_newBabelAwardCollection'), (err, resp, data) => {
71 | try {
72 | if (err) {
73 | console.log(`${JSON.stringify(err)}`)
74 | console.log(`${$.name} user/exchange/bean API请求失败,请检查网路重试\n`)
75 | } else {
76 | console.log(moment().format("YYYY-MM-DD HH:mm:ss.SSS"));
77 | console.log(data);
78 | if (safeGet(data)) {
79 | data = JSON.parse(data);
80 | console.log(`抢券结果:${JSON.stringify(data)}\n`)
81 | }
82 | }
83 | } catch (e) {
84 | $.logErr(e, resp)
85 | } finally {
86 | resolve();
87 | }
88 | })
89 | })
90 | }
91 |
92 | function taskUrl(function_id, body = {}) {
93 | return {
94 | url: `https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection`,
95 | headers: {
96 | "Accept": "*/*",
97 | "Accept-Encoding": "gzip, deflate, br",
98 | "Accept-Language": "zh-cn",
99 | "Connection": "keep-alive",
100 | "Content-Type": "application/x-www-form-urlencoded",
101 | 'origin': 'https://pro.m.jd.com',
102 | "Referer": "https://pro.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?lng=106.476617&lat=29.502674&sid=fbc43764317f538b90e0f9ab43c8285w&un_area=4_50952_106_0",
103 | "Cookie": cookie,
104 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
105 | },
106 | body: "body=%7B%22activityId%22%3A%22vN4YuYXS1mPse7yeVPRq4TNvCMR%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3D559C198F83CBF1D793C9CD8897A92C18F98661A99E0E88D4F7B3940DD96721B7E4385B29B20822D37D3994F74442D475_bingo%2CroleId%3D97EA407DBD290058DD2445A38BDEAA95_bingo%2CstrengthenKey%3D7234093DC9375F51DDB7D38147D7AD82EAEB0938B43AC37CCC32084DCB1D13220B0BC72B40D2A533AECDE44C56DDD2A6_bingo%22%2C%22platform%22%3A%221%22%2C%22orgType%22%3A%222%22%2C%22openId%22%3A%22-1%22%2C%22pageClickKey%22%3A%22-1%22%2C%22eid%22%3A%22EI7EMAW4ZLYP7BA2NPR3ZRDMA62D4SQSQ4OOFANS47F4GEBK2DN3LPSAVISERLPHUS75YZCZUXNDFNIQKRL6PXLHCE%22%2C%22fp%22%3A%2270f2dc96f49aff6d2f3b4853a9f14aec%22%2C%22shshshfp%22%3A%22ee4e5230303de14a90f528be37f6cac1%22%2C%22shshshfpa%22%3A%22f62b6f85-ed1a-19a9-a983-5386fd853f3e-1633620784%22%2C%22shshshfpb%22%3A%22s5ANXcvD4c4lgaATnZ%2Fdzaw%3D%3D%22%2C%22childActivityUrl%22%3A%22https%253A%252F%252Fpro.m.jd.com%252Fjdlite%252Factive%252FvN4YuYXS1mPse7yeVPRq4TNvCMR%252Findex.html%253Flng%253D106.476461%2526lat%253D29.502654%2526sid%253Dc0bd62a7a67b30b66ea8792ba0d6709w%2526un_area%253D4_50952_106_0%22%2C%22userArea%22%3A%22-1%22%2C%22client%22%3A%22-1%22%2C%22clientVersion%22%3A%22-1%22%2C%22uuid%22%3A%22-1%22%2C%22osVersion%22%3A%22-1%22%2C%22brand%22%3A%22-1%22%2C%22model%22%3A%22-1%22%2C%22networkType%22%3A%22-1%22%2C%22jda%22%3A%22122270672.16425253116601960425755.1642525311.1647103120.1647154596.287%22%2C%22sdkToken%22%3A%22%22%2C%22token%22%3A%22JN5HWIKH6JURG3DOC6BHD42SKFZKXHBZPTXBPEQARAL6ZUL3TFXOVJYSHOKVENECMPGY6R3S6IMKK%22%2C%22jstub%22%3A%22EAJ5CVOEGF3PHTIUYNLPKI4BQQBBINY3UFNPLDHFX46AYZPOZUWUSRMWI73UBKMYFXIERXMMVMK32GHCUTPC5ASZEMRFSFMUJHCRP7Q%22%2C%22pageClick%22%3A%22Babel_Coupon%22%2C%22couponSource%22%3A%22ace%22%2C%22couponSourceDetail%22%3A%22-100%22%2C%22channel%22%3A%22%E9%80%9A%E5%A4%A9%E5%A1%94%E4%BC%9A%E5%9C%BA%22%2C%22batchId%22%3A%22843424078%22%2C%22headArea%22%3A%22605715ec560d6508f7403b91b677d79c%22%2C%22sceId%22%3A%22TTTh5%22%2C%22rstr%22%3A%2275293885%22%2C%22sstr%22%3A%221647154807770~16JE9yISbtJMDFIWEZ2aTAxMQ%3D%3D.eW5yQVh9bH5GW31qfwhbejV%2BDFwqFCkYF3l0cVpfZGk4RBd5JjVDKAYAJQAtfDtyGg4pGRIYM2c8PBcedWU4.9b1fc10e~6%2C1~500AA031177C21E187362A38E885A259671D6417~06s1gvr~C~SRZGVBYMbWweF0ZaXxsObRRVAxgKdx58cRoHcx5AHkAQFRZSAxwKcx5xeRVjcxpQHkEQGBBdAxsOdx5weRhqfBhXGkUQaB4WVUtaFAwDHhdBRxADFgcABQUEBwAKCQICBwIHAAoCEBUWQVNVEA8QQEZNQEJQRFQXHhZFXFUUDBNUU0ZARk1BVxQdEEVWWhADbwQPHQYBChgDARgBGgAeAG8YEFNeFAwCHhdRRxADFg4BBAECAw1QDwAPBlUEVgNVBwlVD1MGAQQDAgEKAFBSEx4XXEQQAxZfZlldW1cWHhtAFAwABAEFBQcNDAYBBgUFHhZYUhYMFFAQGRBSQlsWDBRCB3R8bFFPcAJVBV5SU3VmV24ZUktTQg8JEBUWWEATCBdzREJVURZ1Xl9FR0BXSxgWf19RGxAYEFdVQBQLEAQDBgEbGBRFUkAXCG8FCgIaAgAGaB4WQFYWDG0TW2VaW1xcDBoEEx4XW3thGxgUBwUcDRAYEAoaDhgAAhceFgMIBgUUHRBUUA1UXw0OBwEGVlMFVglRDwAHAVNXBQBbAwYDUlMFBgRTXwYEAFRRFx4WUxtpGhRYXVQQDhBfUlBQV1RBRhYeG1VcFAsQQBAYEFpdFAwTRQYcABwKFhoUUlRqRBYIGwQHFB0QV1YWCBtGV1hVXVgPAwcLDQUOCQcXHhZfUxYMbQAeBR4EbxUWVFpeVRcIFlMbGBRbQlUXCBZTG0k%3D~18qjggq%22%2C%22mitemAddrId%22%3A%22%22%2C%22geo%22%3A%7B%22lng%22%3A%22106.476461%22%2C%22lat%22%3A%2229.502654%22%7D%2C%22addressId%22%3A%22%22%2C%22posLng%22%3A%22%22%2C%22posLat%22%3A%22%22%2C%22focus%22%3A%22%22%2C%22innerAnchor%22%3A%22%22%2C%22cv%22%3A%222.0%22%7D&screen=1242*2016&client=wh5&clientVersion=1.0.0&sid=c0bd62a7a67b30b66ea8792ba0d6709w&uuid=16425253116601960425755.77.1647154806513&area=4_50952_106_0"
107 | }
108 | }
109 |
110 | function TotalBean() {
111 | return new Promise(async resolve => {
112 | const options = {
113 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
114 | "headers": {
115 | "Accept": "application/json,text/plain, */*",
116 | "Content-Type": "application/x-www-form-urlencoded",
117 | "Accept-Encoding": "gzip, deflate, br",
118 | "Accept-Language": "zh-cn",
119 | "Connection": "keep-alive",
120 | "Cookie": cookie,
121 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
122 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
123 | }
124 | }
125 | $.post(options, (err, resp, data) => {
126 | try {
127 | if (err) {
128 | console.log(`${JSON.stringify(err)}`)
129 | console.log(`${$.name} API请求失败,请检查网路重试`)
130 | } else {
131 | if (data) {
132 | data = JSON.parse(data);
133 | if (data['retcode'] === 13) {
134 | $.isLogin = false; //cookie过期
135 | return
136 | }
137 | if (data['retcode'] === 0) {
138 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
139 | } else {
140 | $.nickName = $.UserName
141 | }
142 | } else {
143 | console.log(`京东服务器返回空数据`)
144 | }
145 | }
146 | } catch (e) {
147 | $.logErr(e, resp)
148 | } finally {
149 | resolve();
150 | }
151 | })
152 | })
153 | }
154 |
155 | function safeGet(data) {
156 | try {
157 | if (typeof JSON.parse(data) == "object") {
158 | return true;
159 | }
160 | } catch (e) {
161 | console.log(e);
162 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
163 | return false;
164 | }
165 | }
166 | function jsonParse(str) {
167 | if (typeof str == "string") {
168 | try {
169 | return JSON.parse(str);
170 | } catch (e) {
171 | console.log(e);
172 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
173 | return [];
174 | }
175 | }
176 | }
177 | // prettier-ignore
178 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
179 |
--------------------------------------------------------------------------------
/bak/jd_5_2.js:
--------------------------------------------------------------------------------
1 | /*
2 | 极速版抢卷
3 |
4 | ============Quantumultx===============
5 | [task_local]
6 | #极速版抢卷
7 | 58 59 6,9,14,17,20 * * * https://raw.githubusercontent.com/KingRan/KR/main/jd_5_2.js, tag=极速版抢卷, enabled=true
8 | ================Loon==============
9 | [Script]
10 | cron "58 59 6,9,14,17,20 * * *" script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_5_2.js,tag=极速版抢卷
11 | ===============Surge=================
12 | 极速版抢卷 = type=cron,cronexp="58 59 6,9,14,17,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_5_2.js
13 | ============小火箭=========
14 | 极速版抢卷 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_5_2.js, cronexpr="58 59 6,9,14,17,20 * * *", timeout=3600, enable=true
15 | */
16 | const $ = new Env('抢极速版全品卷5-2');
17 | const moment = require('moment');
18 | //进容器安装依赖: npm install -g moment
19 | const notify = $.isNode() ? require('./sendNotify') : '';
20 | //Node.js用户请在jdCookie.js处填写京东ck;
21 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
22 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
23 | const randomCount = $.isNode() ? 30 : 5;
24 | //IOS等用户直接用NobyDa的jd cookie
25 | let cookiesArr = [], cookie = '', message;
26 | if ($.isNode()) {
27 | Object.keys(jdCookieNode).forEach((item) => {
28 | cookiesArr.push(jdCookieNode[item])
29 | })
30 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
31 | };
32 | } else {
33 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
34 | }
35 | const JD_API_HOST = 'https://api.m.jd.com/client.action?';
36 | let wait = ms => new Promise(resolve => setTimeout(resolve, ms));
37 | !(async () => {
38 | if (!cookiesArr[0]) {
39 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
40 | return;
41 | }
42 | await wait(100)
43 | for (let j = 0; j < randomCount; ++j)
44 | for (let i = 0; i < 7; i++) {
45 | if (cookiesArr[i]) {
46 | cookie = cookiesArr[i];
47 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
48 | $.index = i + 1;
49 | console.log(`*********京东账号${$.index} ${$.UserName}*********`)
50 | $.isLogin = true;
51 | $.nickName = '';
52 | message = '';
53 | await qiang();
54 | }
55 | }
56 | })()
57 | .catch((e) => {
58 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
59 | })
60 | .finally(() => {
61 | $.done();
62 | })
63 |
64 | async function qiang() {
65 | await exchange()
66 | }
67 |
68 | function exchange() {
69 | return new Promise(resolve => {
70 | $.post(taskUrl('functionId=lite_newBabelAwardCollection'), (err, resp, data) => {
71 | try {
72 | if (err) {
73 | console.log(`${JSON.stringify(err)}`)
74 | console.log(`${$.name} user/exchange/bean API请求失败,请检查网路重试\n`)
75 | } else {
76 | console.log(moment().format("YYYY-MM-DD HH:mm:ss.SSS"));
77 | console.log(data);
78 | if (safeGet(data)) {
79 | data = JSON.parse(data);
80 | console.log(`抢券结果:${JSON.stringify(data)}\n`)
81 | }
82 | }
83 | } catch (e) {
84 | $.logErr(e, resp)
85 | } finally {
86 | resolve();
87 | }
88 | })
89 | })
90 | }
91 |
92 | function taskUrl(function_id, body = {}) {
93 | return {
94 | url: `https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection`,
95 | headers: {
96 | "Accept": "*/*",
97 | "Accept-Encoding": "gzip, deflate, br",
98 | "Accept-Language": "zh-cn",
99 | "Connection": "keep-alive",
100 | "Content-Type": "application/x-www-form-urlencoded",
101 | 'origin': 'https://pro.m.jd.com',
102 | "Referer": "https://pro.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?lng=106.476617&lat=29.502674&sid=fbc43764317f538b90e0f9ab43c8285w&un_area=4_50952_106_0",
103 | "Cookie": cookie,
104 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
105 | },
106 | body: "body=%7B%22activityId%22%3A%223H885vA4sQj6ctYzzPVix4iiYN2P%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3D82955FF5B19B4873DD7044D75B44AD907C1A9FECE3BD974B2E35492750271EA91192D5362104AA91EDD08FFB7EFA944C_bingo%2CroleId%3D04BCD352B47E5A8B92C7D4ED398FBE33_bingo%2CstrengthenKey%3DB95D6A81ACB1760E33CCD3461D64D27E5446F252C845E06C8CA0282A6B890B8633E6D3F3DA7B9E4184103EF5ECD45DDB_bingo%22%2C%22platform%22%3A%221%22%2C%22orgType%22%3A%222%22%2C%22openId%22%3A%22-1%22%2C%22pageClickKey%22%3A%22-1%22%2C%22eid%22%3A%22I3Q65STURLZJUNF3MG743ZFJE5XYQDFHRZSCQ5YDS6T4CSPC6RA6MMZMP2IXIYWSNNO6WA5FIY4RIB42XNRSUMMRTU%22%2C%22fp%22%3A%22a82cb7997e7c879cb36b06f5e0574691%22%2C%22shshshfp%22%3A%2232568b7604006026de6f4754706c832e%22%2C%22shshshfpa%22%3A%22f585c87a-29b9-5140-8d32-4534dde58fb9-1609327675%22%2C%22shshshfpb%22%3A%22b0EElfCWaahraD7QwIlrPdQ%22%2C%22childActivityUrl%22%3A%22https%253A%252F%252Fprodev.m.jd.com%252Fjdlite%252Factive%252F3H885vA4sQj6ctYzzPVix4iiYN2P%252Findex.html%253Fsid%253Dff03fc0d68d4ca7443ab37714b04131w%2526un_area%253D4_50952_106_0%22%2C%22userArea%22%3A%22-1%22%2C%22client%22%3A%22-1%22%2C%22clientVersion%22%3A%22-1%22%2C%22uuid%22%3A%22-1%22%2C%22osVersion%22%3A%22-1%22%2C%22brand%22%3A%22-1%22%2C%22model%22%3A%22-1%22%2C%22networkType%22%3A%22-1%22%2C%22jda%22%3A%22123122771.1637222757035542254276.1637222757.1646064174.1646117985.608%22%2C%22sdkToken%22%3A%22%22%2C%22token%22%3A%226ZIWOHGENB6BTQXTEJGZBDLY7MBHBBWZY57SZZCKGLYBXRIUOIZHJ4ZTEAJ3FTZWIC5R2AN2FATZG%22%2C%22jstub%22%3A%22DAAP6BRCQ74QJKGZ6FZ4ECXWDXYP5TM7P4B3DGCISN6NZGXIAQL6ZXUK37FXHLKCIBNCFI7KSSPCTSWKMCHBSIPLOS252WK5XTQWY6Y%22%2C%22pageClick%22%3A%22Babel_Coupon%22%2C%22couponSource%22%3A%22manual%22%2C%22couponSourceDetail%22%3A%22-100%22%2C%22channel%22%3A%22%E9%80%9A%E5%A4%A9%E5%A1%94%E4%BC%9A%E5%9C%BA%22%2C%22headArea%22%3A%22605715ec560d6508f7403b91b677d79c%22%2C%22sceId%22%3A%22TTTh5%22%2C%22rstr%22%3A%2286233562%22%2C%22sstr%22%3A%221646118012785~1CrvO1aLzPBMDFYQlRjSDAxMQ%3D%3D.aXRgVXlpemRTfWhzZB07b3syCQtoFgFbNmluY09%2BdHMqUTZpPDZTDR0uMiAfOSM8ESkcdQUUATQwBAcZJg%3D%3D.d0f8b630~6%2C1~FE1942E399680CE55B3C0763CE155F6D34457B61~1v2z2hn~C~TxpGXxUKaRRVARkMdB51ah4DYQ8YChwGBAAeQhMbFlwEHwIBHgFpGwIMex4FHgYFARtAGm8eFURcWxMNbxpWAxoGBhoJZBgPAnkbRR5CExsWXAcfAWAeAXcbDXwHHgUeAQUBG0AaHhBTBx8AYRsDfh4Lc3YeBB8EBwgeRhVtHhRWRVoaCAMbEkFFEw0WCQQGAQEDDgEHBQ4CBQABBQYTGxZPV1YVChBCRUNATFRHURIeFEZSVRoIEFFWRkJFQ0FZEB4VQFZYEw1vCwYeAwUAAx0GDBQDBBsBHgNsGxZSWBANAR4UUkQWAhALUVIHVwQCVwgHBVZSU1VXAwEABgsGBQtVVVFSC1BTUhIeFF9HFgIQfl5eR04RVlVKUVoBBBAaE0MWAgMEAwYDBwkHBQoFCgIcEFxaFQ4aHx8BVAQBUFQMWgsBAAZQVVQPFhQQVEdSEAwTVQR9d15Rc2VXUF9GWXYFZkd7WkNnUGkQHhVeRBQLFXNXXVVbVRJ%2FX1QaGh4QWVFEFAsVBgoFBBUcEEVSRRYCaQoHAB4FBwdpFBBAWBIIbRN0cGEfc3kJAhQdFVVWVkBYWVYUHRUFCBAeFQMcDh8GBhoeEAUCBQATGxYOAQYBBgEBAgYCCwQKBAIEGwgEBwsFAQEDAAACAQEOCgEVHBAHE2oYGltdVhIIFFdRUl5UVENEEBoTVl4aCBBCEh4UUl4WAhBFBB4GGAIVGBpRVGhGEAwTBwUaHhBVVBAME0VVVlZdWg0KAAMEBw0EABUcEFtbFQ5jAwcbAx4EbBsWWl5dUBIIFFAVGBpfQVASCBRQFUk%3D~0g61ehn%22%2C%22mitemAddrId%22%3A%22%22%2C%22geo%22%3A%7B%22lng%22%3A%22%22%2C%22lat%22%3A%22%22%7D%2C%22addressId%22%3A%223909001077%22%2C%22posLng%22%3A%22106.476904%22%2C%22posLat%22%3A%2229.502927%22%2C%22focus%22%3A%22%22%2C%22innerAnchor%22%3A%22%22%2C%22cv%22%3A%222.0%22%7D&screen=1080*2145&client=wh5&clientVersion=1.0.0&sid=ff03fc0d68d4ca7443ab37714b04131w&uuid=1637222757035542254276.2314.1646118012292&area=4_50952_106_0"
107 | }
108 | }
109 |
110 | function TotalBean() {
111 | return new Promise(async resolve => {
112 | const options = {
113 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
114 | "headers": {
115 | "Accept": "application/json,text/plain, */*",
116 | "Content-Type": "application/x-www-form-urlencoded",
117 | "Accept-Encoding": "gzip, deflate, br",
118 | "Accept-Language": "zh-cn",
119 | "Connection": "keep-alive",
120 | "Cookie": cookie,
121 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
122 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
123 | }
124 | }
125 | $.post(options, (err, resp, data) => {
126 | try {
127 | if (err) {
128 | console.log(`${JSON.stringify(err)}`)
129 | console.log(`${$.name} API请求失败,请检查网路重试`)
130 | } else {
131 | if (data) {
132 | data = JSON.parse(data);
133 | if (data['retcode'] === 13) {
134 | $.isLogin = false; //cookie过期
135 | return
136 | }
137 | if (data['retcode'] === 0) {
138 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
139 | } else {
140 | $.nickName = $.UserName
141 | }
142 | } else {
143 | console.log(`京东服务器返回空数据`)
144 | }
145 | }
146 | } catch (e) {
147 | $.logErr(e, resp)
148 | } finally {
149 | resolve();
150 | }
151 | })
152 | })
153 | }
154 |
155 | function safeGet(data) {
156 | try {
157 | if (typeof JSON.parse(data) == "object") {
158 | return true;
159 | }
160 | } catch (e) {
161 | console.log(e);
162 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
163 | return false;
164 | }
165 | }
166 | function jsonParse(str) {
167 | if (typeof str == "string") {
168 | try {
169 | return JSON.parse(str);
170 | } catch (e) {
171 | console.log(e);
172 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
173 | return [];
174 | }
175 | }
176 | }
177 | // prettier-ignore
178 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
179 |
--------------------------------------------------------------------------------
/bak/jd_10_4.js:
--------------------------------------------------------------------------------
1 | /*
2 | 极速版抢卷
3 |
4 | ============Quantumultx===============
5 | [task_local]
6 | #极速版抢卷
7 | 58 59 7,10,13,15,19 * * * https://raw.githubusercontent.com/KingRan/KR/main/jd_10_4.js, tag=极速版抢卷, enabled=true
8 | ================Loon==============
9 | [Script]
10 | cron "58 59 7,10,13,15,19 * * *" script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_10_4.js,tag=极速版抢卷
11 | ===============Surge=================
12 | 极速版抢卷 = type=cron,cronexp="58 59 7,10,13,15,19 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_10_4.js
13 | ============小火箭=========
14 | 极速版抢卷 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/KR/main/jd_10_4.js, cronexpr="58 59 7,10,13,15,19 * * *", timeout=3600, enable=true
15 | */
16 | const $ = new Env('抢极速版全品卷10-4');
17 | const moment = require('moment');
18 | //进容器安装依赖: npm install -g moment
19 | const notify = $.isNode() ? require('./sendNotify') : '';
20 | //Node.js用户请在jdCookie.js处填写京东ck;
21 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
22 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
23 | const randomCount = $.isNode() ? 30 : 5;
24 | //IOS等用户直接用NobyDa的jd cookie
25 | let cookiesArr = [], cookie = '', message;
26 | if ($.isNode()) {
27 | Object.keys(jdCookieNode).forEach((item) => {
28 | cookiesArr.push(jdCookieNode[item])
29 | })
30 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
31 | };
32 | } else {
33 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
34 | }
35 | const JD_API_HOST = 'https://api.m.jd.com/client.action?';
36 | let wait = ms => new Promise(resolve => setTimeout(resolve, ms));
37 | !(async () => {
38 | if (!cookiesArr[0]) {
39 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
40 | return;
41 | }
42 | await wait(100)
43 | for (let j = 0; j < randomCount; ++j)
44 | for (let i = 0; i < 7; i++) {
45 | if (cookiesArr[i]) {
46 | cookie = cookiesArr[i];
47 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
48 | $.index = i + 1;
49 | console.log(`*********京东账号${$.index} ${$.UserName}*********`)
50 | $.isLogin = true;
51 | $.nickName = '';
52 | message = '';
53 | await qiang();
54 | }
55 | }
56 | })()
57 | .catch((e) => {
58 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
59 | })
60 | .finally(() => {
61 | $.done();
62 | })
63 |
64 | async function qiang() {
65 | await exchange()
66 | }
67 |
68 | function exchange() {
69 | return new Promise(resolve => {
70 | $.post(taskUrl('functionId=lite_newBabelAwardCollection'), (err, resp, data) => {
71 | try {
72 | if (err) {
73 | console.log(`${JSON.stringify(err)}`)
74 | console.log(`${$.name} user/exchange/bean API请求失败,请检查网路重试\n`)
75 | } else {
76 | console.log(moment().format("YYYY-MM-DD HH:mm:ss.SSS"));
77 | console.log(data);
78 | if (safeGet(data)) {
79 | data = JSON.parse(data);
80 | console.log(`抢券结果:${JSON.stringify(data)}\n`)
81 | }
82 | }
83 | } catch (e) {
84 | $.logErr(e, resp)
85 | } finally {
86 | resolve();
87 | }
88 | })
89 | })
90 | }
91 |
92 | function taskUrl(function_id, body = {}) {
93 | return {
94 | url: `https://api.m.jd.com/client.action?functionId=lite_newBabelAwardCollection`,
95 | headers: {
96 | "Accept": "*/*",
97 | "Accept-Encoding": "gzip, deflate, br",
98 | "Accept-Language": "zh-cn",
99 | "Connection": "keep-alive",
100 | "Content-Type": "application/x-www-form-urlencoded",
101 | 'origin': 'https://pro.m.jd.com',
102 | "Referer": "https://pro.m.jd.com/jdlite/active/3H885vA4sQj6ctYzzPVix4iiYN2P/index.html?lng=106.476617&lat=29.502674&sid=fbc43764317f538b90e0f9ab43c8285w&un_area=4_50952_106_0",
103 | "Cookie": cookie,
104 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
105 | },
106 | body: "body=%7B%22activityId%22%3A%223H885vA4sQj6ctYzzPVix4iiYN2P%22%2C%22scene%22%3A%221%22%2C%22args%22%3A%22key%3D9F77A904F38D9D2EA7968850FE8E4CF8408EF50BCE7C6FF518E48C3F1453D4DDDE2267491E3A0134A4B3422E11261222_bingo%2CroleId%3DF922BBE3F2239AD921A7360D331C1010_bingo%2CstrengthenKey%3DB95D6A81ACB1760E33CCD3461D64D27E5446F252C845E06C8CA0282A6B890B867AEA65FD45E7E5520011C2732A9CACFC_bingo%22%2C%22platform%22%3A%221%22%2C%22orgType%22%3A%222%22%2C%22openId%22%3A%22-1%22%2C%22pageClickKey%22%3A%22-1%22%2C%22eid%22%3A%22I3Q65STURLZJUNF3MG743ZFJE5XYQDFHRZSCQ5YDS6T4CSPC6RA6MMZMP2IXIYWSNNO6WA5FIY4RIB42XNRSUMMRTU%22%2C%22fp%22%3A%22965006c8a769d4b3237ae21a65b805d4%22%2C%22shshshfp%22%3A%224cbb98cccd461ab8fc7e39b08ecfe805%22%2C%22shshshfpa%22%3A%22f585c87a-29b9-5140-8d32-4534dde58fb9-1609327675%22%2C%22shshshfpb%22%3A%22b0EElfCWaahraD7QwIlrPdQ%22%2C%22childActivityUrl%22%3A%22https%253A%252F%252Fprodev.m.jd.com%252Fjdlite%252Factive%252F3H885vA4sQj6ctYzzPVix4iiYN2P%252Findex.html%253Fsid%253Dff03fc0d68d4ca7443ab37714b04131w%2526un_area%253D4_50952_106_0%22%2C%22userArea%22%3A%22-1%22%2C%22client%22%3A%22-1%22%2C%22clientVersion%22%3A%22-1%22%2C%22uuid%22%3A%22-1%22%2C%22osVersion%22%3A%22-1%22%2C%22brand%22%3A%22-1%22%2C%22model%22%3A%22-1%22%2C%22networkType%22%3A%22-1%22%2C%22jda%22%3A%22123122771.1637222757035542254276.1637222757.1646117985.1646121572.609%22%2C%22sdkToken%22%3A%22%22%2C%22token%22%3A%22B56Y4232XY7COVGF5IPU3YT4DAQMRT47QK26LDUMXO4KRJ3AGLKXJ4PFSY6PEGG3NYBGXIEOUIOD6%22%2C%22jstub%22%3A%22PQIYFEV4ZR2F3A7OJAF4KK6QJJJXYKBD6ZCDPCKXOJNB77DMMOOXU2H5TJQF4FFDKPE6WD4PQX3EBDVHA3R3TSZMRXM5KN3DXCQNXWQ%22%2C%22pageClick%22%3A%22Babel_Coupon%22%2C%22couponSource%22%3A%22manual%22%2C%22couponSourceDetail%22%3A%22-100%22%2C%22channel%22%3A%22%E9%80%9A%E5%A4%A9%E5%A1%94%E4%BC%9A%E5%9C%BA%22%2C%22headArea%22%3A%22605715ec560d6508f7403b91b677d79c%22%2C%22sceId%22%3A%22TTTh5%22%2C%22rstr%22%3A%2231267733%22%2C%22sstr%22%3A%221646121608747~1reRxj9dkBJMDFwcnphaDAxMQ%3D%3D.QUROV1lCQ0xRWUhBTx8EPAJPCAE5GQ9RFkFeTU1eXEMEUxZBDBhRLTUeHCI%2FERMSEwk0RSsWIRwAKgU5Dg%3D%3D.04a03615~6%2C1~26503B12556DCE01C55D74E70B46B2488BA39D15~0l7ko1w~C~QxZCWBcLaRBRDhkAdBkJfR4BfnoaBhsHBgIZTBYaF1EHHwVwFAByGQFlBR4GFgICBRlFEG8ZGkBYWBcLaRBRDxlyBxkJCh4AaHsaBhsGBQIZTBYaF1EEHwUGFAwEGQJ%2BZx4GFg0FBRlFEB4XXAMbAgYdCgAZD2RsGQYfCwEFFEAUaBkTVUBbGg4HGRdCQRAPGgUAAQMAAAMDCAQGBAUEBgAAGhgUQlBVEAgXTEBCQUFXR1QXFBZBUFQTCBBTXkBCQUFEUxAZGkRSWxcLaQEBFAADBw0dAwoZCQIaBBkEbx4XUl4UDwQdEFFGGg4UDFNTB1MADVcGAAJQUFNWXgADDQEIAwcMW1BQUwZTU1cXFBZYRRcLEH5cVkFOFVRQQFFdDgAUGRdFEAgEDgAABAcABAINDwABGRdbWRAPGhkbA1EHBVNWAFYPBgIHUFFQABYaF1NBUBAPGlYGcHBdVHFiWVVeR1R1BWNCcVhEZVFgEB4XVkIUDxd2XV1SVFEWfFtSHBAZGlpXQxcLEAAHDwIUGRdCUUAXAm8OBQUdAQQFZRgUR1oTCGkXe3BvGHR%2FCwIXFBZXW1FDXVtRGhgUBAUTHhAGFgwYBAcTHhAHCgMAFxkTBAEBDgIFAgYABAEDAAcEAxgIAQEGDwcABgcHAQQADgwFFxkTAxBoFBZfWlQTCBBTXlJQU1NFRhAZGlVcFw8TRxAZGldfFw8TRQEbDBoFFxkTUVRqThYMFwUAEB4XWlAUDxdDU1xRV1kLBgQDBAUCCwcUGRdcWBAPYwUEGQEdAG8ZGlZaWlITCBBUGhgUWEZWEAgXWRZL~1fg6t6v%22%2C%22mitemAddrId%22%3A%22%22%2C%22geo%22%3A%7B%22lng%22%3A%22%22%2C%22lat%22%3A%22%22%7D%2C%22addressId%22%3A%223909001077%22%2C%22posLng%22%3A%22106.476904%22%2C%22posLat%22%3A%2229.502927%22%2C%22focus%22%3A%22%22%2C%22innerAnchor%22%3A%22%22%2C%22cv%22%3A%222.0%22%7D&screen=1080*2145&client=wh5&clientVersion=1.0.0&sid=ff03fc0d68d4ca7443ab37714b04131w&uuid=1637222757035542254276.2314.1646121609350&area=4_50952_106_0"
107 | }
108 | }
109 |
110 | function TotalBean() {
111 | return new Promise(async resolve => {
112 | const options = {
113 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
114 | "headers": {
115 | "Accept": "application/json,text/plain, */*",
116 | "Content-Type": "application/x-www-form-urlencoded",
117 | "Accept-Encoding": "gzip, deflate, br",
118 | "Accept-Language": "zh-cn",
119 | "Connection": "keep-alive",
120 | "Cookie": cookie,
121 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
122 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
123 | }
124 | }
125 | $.post(options, (err, resp, data) => {
126 | try {
127 | if (err) {
128 | console.log(`${JSON.stringify(err)}`)
129 | console.log(`${$.name} API请求失败,请检查网路重试`)
130 | } else {
131 | if (data) {
132 | data = JSON.parse(data);
133 | if (data['retcode'] === 13) {
134 | $.isLogin = false; //cookie过期
135 | return
136 | }
137 | if (data['retcode'] === 0) {
138 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
139 | } else {
140 | $.nickName = $.UserName
141 | }
142 | } else {
143 | console.log(`京东服务器返回空数据`)
144 | }
145 | }
146 | } catch (e) {
147 | $.logErr(e, resp)
148 | } finally {
149 | resolve();
150 | }
151 | })
152 | })
153 | }
154 |
155 | function safeGet(data) {
156 | try {
157 | if (typeof JSON.parse(data) == "object") {
158 | return true;
159 | }
160 | } catch (e) {
161 | console.log(e);
162 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
163 | return false;
164 | }
165 | }
166 | function jsonParse(str) {
167 | if (typeof str == "string") {
168 | try {
169 | return JSON.parse(str);
170 | } catch (e) {
171 | console.log(e);
172 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
173 | return [];
174 | }
175 | }
176 | }
177 | // prettier-ignore
178 | function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
179 |
--------------------------------------------------------------------------------
/ym/bak/lmz.js:
--------------------------------------------------------------------------------
1 | /*
2 | cron "18 8 * * *" yml_javascript/lnz.js tag=狸猫赚, enabled=fglse
3 | 20220305 tom
4 | 2022-3-15 yml瞎改(账号密码登录)
5 | 不能签到了 可以禁用脚本了
6 |
7 | 软件名称:狸猫赚
8 | tom大佬邀请:下载地址:http://www.limaozhan.com/home/auth/registerr.html?i=12064
9 | 我的邀请: 下载地址:http://www.limaozhan.com/home/auth/registerr.html?i=13849
10 |
11 | 只写了签到,每天3毛,1元提现
12 | 感谢tom大佬的项目,感谢leaf大佬指导
13 |
14 | 注意事项 : 一定要仔细阅读一下内容
15 | =============青龙变量格式=============
16 | export yml_lmz_data='username=手机号&password=密码'
17 | 多账号使用 @ 分割;
18 | =============青龙变量实例=============
19 | 我觉得已经不需要例子了 填上账号密码再不回那就别薅羊毛了吧
20 | =============变量解释==========
21 | 手机号 密码 填入自己的数据就行
22 | =============变量获取==========
23 | 懒得写了,自己研究吧
24 | 不会的请百度或者群里求助:QQ群:884234287 tg:https://t.me/yml_tg
25 |
26 | */
27 | const $ = new Env('狸猫赚');
28 | const notify = $.isNode() ? require('./sendNotify') : '';
29 | let body = '';
30 | let web_yml_lmz_data = '';
31 |
32 | !(async () => {
33 | if ($.isNode()) {
34 | //$.isNode()环境执行部分 青龙执行
35 | if (!process.env.yml_lmz_data) {
36 | console.log(`\n【${$.name}】:未填写相应变量 yml_lmz_data`);
37 | return;
38 | }
39 | if (process.env.yml_lmz_data && process.env.yml_lmz_data.indexOf('@') > -1) {
40 | web_yml_lmz_data = process.env.yml_lmz_data.split('@');
41 | } else {
42 | web_yml_lmz_data = process.env.yml_lmz_data.split();
43 | }
44 | }
45 |
46 | console.log(`-------- 共 ${web_yml_lmz_data.length} 个账号 --------`)
47 | // console.log(web_yml_lmz_data)
48 | console.log(
49 | `\n\n====== 脚本执行 - 北京时间(UTC+8):${new Date(
50 | new Date().getTime() +
51 | new Date().getTimezoneOffset() * 60 * 1000 +
52 | 8 * 60 * 60 * 1000
53 | ).toLocaleString()} ======\n`);
54 |
55 |
56 | await wyy();
57 |
58 | for (i = 0; i < web_yml_lmz_data.length; i++) {
59 | $.index = i + 1;
60 | console.log(`\n====== 开始【第 ${$.index} 个账号】======`)
61 | // console.log(`这里是分割后:${web_yml_lmz_data}`);
62 | body = web_yml_lmz_data[i];
63 | // console.log(body)
64 |
65 | //执行任务
66 | await lmzdl();
67 | await $.wait(2 * 1000);
68 | await lmzqd();
69 | await $.wait(2 * 1000);
70 | }
71 |
72 | })()
73 | .catch((e) => $.logErr(e))
74 | .finally(() => $.done())
75 |
76 |
77 | //每日网抑云
78 | function wyy(timeout = 3 * 1000) {
79 | return new Promise((resolve) => {
80 | let url = {
81 | url: `https://keai.icu/apiwyy/api`
82 | }
83 | $.get(url, async (err, resp, data) => {
84 | try {
85 | data = JSON.parse(data)
86 | $.log(`\n【网抑云时间】: ${data.content} by--${data.music}`);
87 |
88 | } catch (e) {
89 | $.logErr(e, resp);
90 | } finally {
91 | resolve()
92 | }
93 | }, timeout)
94 | })
95 | }
96 |
97 |
98 |
99 | // 登录
100 | function lmzdl(timeout = 0) {
101 | return new Promise((resolve) => {
102 | let url = {
103 | url: 'https://www.limaozhan.com/home/auth/login.html',
104 | headers: {
105 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
106 | 'X-Requested-With': 'XMLHttpRequest'
107 | },
108 | body: body,
109 |
110 | }
111 | // console.log(url);
112 |
113 | // console.log(result.headers['set-cookie'])
114 |
115 |
116 | $.post(url, async (err, resp, data) => {
117 |
118 | try {
119 | // console.log(`输出data开始===================`);
120 | // console.log(data);
121 | // console.log(`输出data结束===================`);
122 |
123 | result = JSON.parse(data);
124 |
125 | if (result.type == "success") {
126 | $.log(`\n【🎉🎉🎉 恭喜您鸭 🎉🎉🎉】登录状态: ${result.message} ✅ `)
127 | // await $.wait(3 * 1000)
128 | } else {
129 | $.log(`\n【🎉 恭喜个屁 🎉】登录状态:${result.message} `)
130 | }
131 | } catch (e) {
132 | $.logErr(e, resp);
133 | } finally {
134 | resolve()
135 | }
136 | }, timeout)
137 |
138 | })
139 | }
140 |
141 | // 签到
142 | // 取ck
143 | var request = require('request');
144 | let options = {
145 | 'method': 'POST',
146 | 'url': 'https://www.limaozhan.com/home/auth/login.html',
147 | 'headers': {
148 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
149 | 'X-Requested-With': 'XMLHttpRequest'
150 | },
151 | body: body,
152 | };
153 | request(options, function (error, response) {
154 | if (error) throw new Error(error);
155 | cookie = response.headers['set-cookie']
156 | });
157 |
158 |
159 |
160 | function lmzqd(timeout = 0) {
161 |
162 | return new Promise((resolve) => {
163 | let url = {
164 | url: 'https://www.limaozhan.com/index.php/home/account/index',
165 | headers: {
166 | 'X-Requested-With': 'XMLHttpRequest',
167 | 'Cookie': cookie,
168 | },
169 | body: '',
170 |
171 | }
172 | // console.log(url);
173 |
174 | $.post(url, async (err, resp, data) => {
175 |
176 | try {
177 |
178 | // console.log(`输出data开始===================`);
179 | // console.log(data);
180 | // console.log(`输出data结束===================`);
181 |
182 | result = JSON.parse(data);
183 | if (result.type == "success") {
184 | $.log(`\n【🎉🎉🎉 恭喜您鸭 🎉🎉🎉】签到状态:(${result.message}) ✅ `)
185 | // await $.wait(3 * 1000)
186 | } else if (result.type == "error") {
187 | $.log(`\n【🎉 恭喜个屁 🎉】签到状态: ${result.message} `)
188 | } else {
189 | $.log(`\n【🎉 恭喜个屁 🎉】执行签到:失败 ❌ 了呢,原因未知! `)
190 | }
191 | } catch (e) {
192 | $.logErr(e, resp);
193 | } finally {
194 | resolve()
195 | }
196 | }, timeout)
197 |
198 | })
199 | }
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 | //固定板块,无需动
208 | function Env(t, e) {
209 | class s {
210 | constructor(t) {
211 | this.env = t
212 | }
213 |
214 | send(t, e = "GET") {
215 | t = "string" == typeof t ? { url: t } : t;
216 | let s = this.get;
217 | return "POST" === e && (s = this.post), new Promise((e, i) => {
218 | s.call(this, t, (t, s, r) => {
219 | t ? i(t) : e(s)
220 | })
221 | })
222 | }
223 |
224 | get(t) {
225 | return this.send.call(this.env, t)
226 | }
227 |
228 | post(t) {
229 | return this.send.call(this.env, t, "POST")
230 | }
231 | }
232 |
233 | return new class {
234 | constructor(t, e) {
235 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.encoding = "utf-8", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
236 | }
237 |
238 | isNode() {
239 | return "undefined" != typeof module && !!module.exports
240 | }
241 |
242 | isQuanX() {
243 | return "undefined" != typeof $task
244 | }
245 |
246 | isSurge() {
247 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon
248 | }
249 |
250 | isLoon() {
251 | return "undefined" != typeof $loon
252 | }
253 |
254 | isShadowrocket() {
255 | return "undefined" != typeof $rocket
256 | }
257 |
258 | toObj(t, e = null) {
259 | try {
260 | return JSON.parse(t)
261 | } catch {
262 | return e
263 | }
264 | }
265 |
266 | toStr(t, e = null) {
267 | try {
268 | return JSON.stringify(t)
269 | } catch {
270 | return e
271 | }
272 | }
273 |
274 | getjson(t, e) {
275 | let s = e;
276 | const i = this.getdata(t);
277 | if (i) try {
278 | s = JSON.parse(this.getdata(t))
279 | } catch {
280 | }
281 | return s
282 | }
283 |
284 | setjson(t, e) {
285 | try {
286 | return this.setdata(JSON.stringify(t), e)
287 | } catch {
288 | return !1
289 | }
290 | }
291 |
292 | getScript(t) {
293 | return new Promise(e => {
294 | this.get({ url: t }, (t, s, i) => e(i))
295 | })
296 | }
297 |
298 | runScript(t, e) {
299 | return new Promise(s => {
300 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
301 | i = i ? i.replace(/\n/g, "").trim() : i;
302 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
303 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
304 | const [o, h] = i.split("@"), n = {
305 | url: `http://${h}/v1/scripting/evaluate`,
306 | body: { script_text: t, mock_type: "cron", timeout: r },
307 | headers: { "X-Key": o, Accept: "*/*" }
308 | };
309 | this.post(n, (t, e, i) => s(i))
310 | }).catch(t => this.logErr(t))
311 | }
312 |
313 | loaddata() {
314 | if (!this.isNode()) return {};
315 | {
316 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
317 | const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile),
318 | s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e);
319 | if (!s && !i) return {};
320 | {
321 | const i = s ? t : e;
322 | try {
323 | return JSON.parse(this.fs.readFileSync(i))
324 | } catch (t) {
325 | return {}
326 | }
327 | }
328 | }
329 | }
330 |
331 | writedata() {
332 | if (this.isNode()) {
333 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
334 | const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile),
335 | s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data);
336 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
337 | }
338 | }
339 |
340 | lodash_get(t, e, s) {
341 | const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
342 | let r = t;
343 | for (const t of i) if (r = Object(r)[t], void 0 === r) return s;
344 | return r
345 | }
346 |
347 | lodash_set(t, e, s) {
348 | return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
349 | }
350 |
351 | getdata(t) {
352 | let e = this.getval(t);
353 | if (/^@/.test(t)) {
354 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
355 | if (r) try {
356 | const t = JSON.parse(r);
357 | e = t ? this.lodash_get(t, i, "") : e
358 | } catch (t) {
359 | e = ""
360 | }
361 | }
362 | return e
363 | }
364 |
365 | setdata(t, e) {
366 | let s = !1;
367 | if (/^@/.test(e)) {
368 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i),
369 | h = i ? "null" === o ? null : o || "{}" : "{}";
370 | try {
371 | const e = JSON.parse(h);
372 | this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
373 | } catch (e) {
374 | const o = {};
375 | this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
376 | }
377 | } else s = this.setval(t, e);
378 | return s
379 | }
380 |
381 | getval(t) {
382 | return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
383 | }
384 |
385 | setval(t, e) {
386 | return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
387 | }
388 |
389 | initGotEnv(t) {
390 | this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
391 | }
392 |
393 | get(t, e = (() => {
394 | })) {
395 | if (t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => {
396 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
397 | }); else if (this.isQuanX()) this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => {
398 | const { statusCode: s, statusCode: i, headers: r, body: o } = t;
399 | e(null, { status: s, statusCode: i, headers: r, body: o }, o)
400 | }, t => e(t)); else if (this.isNode()) {
401 | let s = require("iconv-lite");
402 | this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
403 | try {
404 | if (t.headers["set-cookie"]) {
405 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
406 | s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
407 | }
408 | } catch (t) {
409 | this.logErr(t)
410 | }
411 | }).then(t => {
412 | const { statusCode: i, statusCode: r, headers: o, rawBody: h } = t;
413 | e(null, { status: i, statusCode: r, headers: o, rawBody: h }, s.decode(h, this.encoding))
414 | }, t => {
415 | const { message: i, response: r } = t;
416 | e(i, r, r && s.decode(r.rawBody, this.encoding))
417 | })
418 | }
419 | }
420 |
421 | post(t, e = (() => {
422 | })) {
423 | const s = t.method ? t.method.toLocaleLowerCase() : "post";
424 | if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient[s](t, (t, s, i) => {
425 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
426 | }); else if (this.isQuanX()) t.method = s, this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => {
427 | const { statusCode: s, statusCode: i, headers: r, body: o } = t;
428 | e(null, { status: s, statusCode: i, headers: r, body: o }, o)
429 | }, t => e(t)); else if (this.isNode()) {
430 | let i = require("iconv-lite");
431 | this.initGotEnv(t);
432 | const { url: r, ...o } = t;
433 | this.got[s](r, o).then(t => {
434 | const { statusCode: s, statusCode: r, headers: o, rawBody: h } = t;
435 | e(null, { status: s, statusCode: r, headers: o, rawBody: h }, i.decode(h, this.encoding))
436 | }, t => {
437 | const { message: s, response: r } = t;
438 | e(s, r, r && i.decode(r.rawBody, this.encoding))
439 | })
440 | }
441 | }
442 |
443 | time(t, e = null) {
444 | const s = e ? new Date(e) : new Date;
445 | let i = {
446 | "M+": s.getMonth() + 1,
447 | "d+": s.getDate(),
448 | "H+": s.getHours(),
449 | "m+": s.getMinutes(),
450 | "s+": s.getSeconds(),
451 | "q+": Math.floor((s.getMonth() + 3) / 3),
452 | S: s.getMilliseconds()
453 | };
454 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
455 | for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
456 | return t
457 | }
458 |
459 | msg(e = t, s = "", i = "", r) {
460 | const o = t => {
461 | if (!t) return t;
462 | if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0;
463 | if ("object" == typeof t) {
464 | if (this.isLoon()) {
465 | let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"];
466 | return { openUrl: e, mediaUrl: s }
467 | }
468 | if (this.isQuanX()) {
469 | let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl;
470 | return { "open-url": e, "media-url": s }
471 | }
472 | if (this.isSurge()) {
473 | let e = t.url || t.openUrl || t["open-url"];
474 | return { url: e }
475 | }
476 | }
477 | };
478 | if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
479 | let t = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
480 | t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
481 | }
482 | }
483 |
484 | log(...t) {
485 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
486 | }
487 |
488 | logErr(t, e) {
489 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
490 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t)
491 | }
492 |
493 | wait(t) {
494 | return new Promise(e => setTimeout(e, t))
495 | }
496 |
497 | done(t = {}) {
498 | const e = (new Date).getTime(), s = (e - this.startTime) / 1e3;
499 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
500 | }
501 | }(t, e)
502 | }
503 |
--------------------------------------------------------------------------------
/ym/顺丰.js:
--------------------------------------------------------------------------------
1 | /*
2 | @肥皂 3.23 顺丰速运+(小程序)-乘风寻宝记
3 | 抓取 mcs-mimp-web.sf-express.com 域名的cookie
4 | cookie会过期,本有方法可以取新的cookie,但是无法禁止该请求重定向
5 | 如果有知道的可以告诉我。。。顺丰乘风寻宝记
6 |
7 | 一天2000积分。。。--短期活动。。
8 | cron "39 15 * * *" tag=顺丰速运
9 | 变量名:cfxbjck @分割多账户
10 |
11 | cron "* 8 * * *"
12 |
13 | */
14 |
15 | const $ = new Env('顺丰乘风寻宝记');
16 | let status;
17 | status = (status = ($.getval("cfxbjstatus") || "1")) > 1 ? `${status}` : ""; // 账号扩展字符
18 | let cfxbjckArr = [], cfxbjcount = ''
19 | let cfxbjck = ($.isNode() ? process.env.cfxbjck : $.getdata('cfxbjck')) || '';
20 | let taskCode = '',taskName='',flightStoneNum = ''
21 | let cookie = ''
22 |
23 |
24 | !(async () => {
25 | if (typeof $request !== "undefined") {
26 | await cfxbjck()
27 |
28 | } else {
29 | cfxbjckArr = cfxbjck.split('@')
30 | console.log(`------------- 共${cfxbjckArr.length}个账号-------------\n`)
31 | for (let i = 0; i < cfxbjckArr.length; i++) {
32 | cfxbjck = cfxbjckArr[i]
33 |
34 |
35 | $.index = i + 1;
36 | console.log(`\n开始【乘风寻宝记${$.index}】`)
37 | //await cfxbjhq()
38 | await cfxbjqd()
39 | await cfxbjlb()
40 | await cfxbjyd()
41 | }
42 | }
43 |
44 | })()
45 | .catch((e) => $.logErr(e))
46 | .finally(() => $.done())
47 | //数据获取
48 |
49 | // function cfxbjhq(timeout = 0) {
50 | // return new Promise((resolve) => {
51 |
52 | // let url = {
53 | // url: cfxbjurl,
54 | // headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Sec-Fetch-Site":"none","Sec-Fetch-Mode":"navigate","Sec-Fetch-User":"?1","Sec-Fetch-Dest":"document","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":""},
55 |
56 | // }
57 | // $.get(url, async (err, resp, data) => {
58 | // try {
59 | // console.log(data); //链接被重定向了。暂时不知道咋禁止重定向。。。。
60 | //
61 |
62 |
63 | // } catch (e) {
64 | // //$.logErr(e, resp);
65 | // } finally {
66 | // resolve()
67 | // }
68 | // }, timeout)
69 | // })
70 | // }
71 |
72 |
73 | //列表
74 | function cfxbjlb(timeout = 0) {
75 | return new Promise((resolve) => {
76 |
77 | let url = {
78 | url: `https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2022TaskService~queryTask`,
79 | headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Accept":"application/json, text/plain, */*","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type":"application/json;charset=UTF-8","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://mcs-mimp-web.sf-express.com/anniversaryWarmFormal?redirectUri=/anniversaryWarmFormal&mobile=158****0800&userId=6A563907EBA94803A1D69087CCD377C0&scene=6150&memberType=0&token=node01cx6xl3i5fckw2pdw9u7bsn4p827356&ifForbid=0&from=29wxappbanner&source=CX&isFinishActivity=true","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":cfxbjck},
80 | body: `{"fromChannel":"MINI_PROGRAM"}`
81 | }
82 | $.post(url, async (err, resp, data) => {
83 | try {
84 | //console.log(data);
85 | const result = JSON.parse(data)
86 | if (result.success == true) {
87 | console.log(`\n乘风寻宝记任务列表获取成功`);
88 | console.log(`\n乘风寻宝记匹配到任务:`+result.obj.taskInfoDTOList.length+'个');
89 | for(let x = 0;x {
116 |
117 | let url = {
118 | url: `https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2022TaskService~fetchSignFlightStone`,
119 | headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Accept":"application/json, text/plain, */*","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type":"application/json;charset=UTF-8","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://mcs-mimp-web.sf-express.com/anniversaryWarmFormal?redirectUri=/anniversaryWarmFormal&mobile=158****0800&userId=6A563907EBA94803A1D69087CCD377C0&scene=6150&memberType=0&token=node01cx6xl3i5fckw2pdw9u7bsn4p827356&ifForbid=0&from=29wxappbanner&source=CX&isFinishActivity=true","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":cfxbjck},
120 | body: `{}`
121 | }
122 | $.post(url, async (err, resp, data) => {
123 | try {
124 | //console.log(data);
125 | const result = JSON.parse(data)
126 | if (result.success == true) {
127 | console.log(`\n乘风寻宝记签到成功`);
128 |
129 |
130 |
131 | } else {
132 |
133 | console.log(`\n乘风寻宝记签到失败:` + result.errorMessage);
134 | }
135 | } catch (e) {
136 | //$.logErr(e, resp);
137 | } finally {
138 | resolve()
139 | }
140 | }, timeout)
141 | })
142 | }
143 | //穿越云朵
144 | function cfxbjyd(timeout = 0) {
145 | return new Promise((resolve) => {
146 |
147 | let url = {
148 | url: `https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2022FormalService~addFlightStone`,
149 | headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Accept":"application/json, text/plain, */*","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type":"application/json;charset=UTF-8","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://mcs-mimp-web.sf-express.com/anniversaryWarmFormal?redirectUri=/anniversaryWarmFormal&mobile=158****0800&userId=6A563907EBA94803A1D69087CCD377C0&scene=6150&memberType=0&token=node01cx6xl3i5fckw2pdw9u7bsn4p827356&ifForbid=0&from=29wxappbanner&source=CX&isFinishActivity=true","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":cfxbjck},
150 | body: `{"stoneNum":100,"opType":"THROUGH_CLOUD"}`
151 | }
152 | $.post(url, async (err, resp, data) => {
153 | try {
154 | //console.log(data);
155 | const result = JSON.parse(data)
156 | if (result.success == true) {
157 | console.log(`\n乘风寻宝记-穿越云朵成功`);
158 |
159 |
160 |
161 | } else {
162 |
163 | console.log(`\n乘风寻宝记穿越云朵:` + result.errorMessage);
164 | }
165 | } catch (e) {
166 | //$.logErr(e, resp);
167 | } finally {
168 | resolve()
169 | }
170 | }, timeout)
171 | })
172 | }
173 |
174 | //做任务
175 | function cfxbjrw(timeout = 0) {
176 | return new Promise((resolve) => {
177 |
178 | let url = {
179 | url: `https://mcs-mimp-web.sf-express.com/mcs-mimp/commonRoutePost/memberEs/taskRecord/finishTask`,
180 | headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Accept":"application/json, text/plain, */*","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type":"application/json;charset=UTF-8","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://mcs-mimp-web.sf-express.com/anniversaryWarmFormal?redirectUri=/anniversaryWarmFormal&mobile=158****0800&userId=6A563907EBA94803A1D69087CCD377C0&scene=6150&memberType=0&token=node01cx6xl3i5fckw2pdw9u7bsn4p827356&ifForbid=0&from=29wxappbanner&source=CX&isFinishActivity=true","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":cfxbjck},
181 | body: `{"taskCode":"${taskCode}"}`
182 | }
183 | $.post(url, async (err, resp, data) => {
184 | try {
185 | //console.log(data);
186 | const result = JSON.parse(data)
187 | if (result.obj == true) {
188 | console.log(`\n乘风寻宝记执行任务`+ result.obj+"成功");
189 | await $.wait(2000)
190 | await cfxbjtj()
191 |
192 |
193 | } else {
194 |
195 | console.log(`\n乘风寻宝记执行任务:` + result.obj+'失败');
196 | await $.wait(2000)
197 | }
198 | } catch (e) {
199 | //$.logErr(e, resp);
200 | } finally {
201 | resolve()
202 | }
203 | }, timeout)
204 | })
205 | }
206 |
207 | //提交
208 | function cfxbjtj(timeout = 0) {
209 | return new Promise((resolve) => {
210 |
211 | let url = {
212 | url: `https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2022TaskService~fetchTaskFlightStone`,
213 | headers: {"Host":"mcs-mimp-web.sf-express.com","Connection":"keep-alive","Accept":"application/json, text/plain, */*","User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type":"application/json;charset=UTF-8","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://mcs-mimp-web.sf-express.com/anniversaryWarmFormal?redirectUri=/anniversaryWarmFormal&mobile=158****0800&userId=6A563907EBA94803A1D69087CCD377C0&scene=6150&memberType=0&token=node01cx6xl3i5fckw2pdw9u7bsn4p827356&ifForbid=0&from=29wxappbanner&source=CX&isFinishActivity=true","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-us,en","Cookie":cfxbjck},
214 | body: `{"taskCode":"${taskCode}"}`
215 | }
216 | $.post(url, async (err, resp, data) => {
217 | try {
218 | //console.log(data);
219 | const result = JSON.parse(data)
220 | if (result.success == true) {
221 | console.log(`\n乘风寻宝记提交任务`+data);
222 | await cfxbjrw()
223 |
224 |
225 | } else {
226 |
227 | console.log(`\n乘风寻宝记提交任务:` + result.errorMessage);
228 | }
229 | } catch (e) {
230 | //$.logErr(e, resp);
231 | } finally {
232 | resolve()
233 | }
234 | }, timeout)
235 | })
236 | }
237 |
238 | function rand(min, max) {
239 | return parseInt(Math.random() * (max - min + 1) + min, 10);
240 | }
241 | function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), a = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(a, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t) { let e = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))); let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }
242 |
--------------------------------------------------------------------------------