1 Star 0 Fork 0

Mr不知为何/jd_scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
thread.py 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
JDHelloWorld 提交于 2021-12-06 15:37 . jd_order_cashback.ts
import threading
import os
import re
import sys
from urllib.parse import quote
cookies = []
def get_cookies():
if not os.path.exists('./test/logs'):
os.makedirs('./test/logs')
with open("jdCookie.js", 'r') as f:
txt = f.read()
for cookie in re.findall("(.*['\"]pt_key[^'|\"]*)", txt):
if '//' not in cookie:
cookie = re.search(r"(pt_key.*)", cookie).group(0)
cookies.append(cookie)
print(len(cookies), cookies)
def main(ck, index):
filename = sys.argv[1]
for file in os.listdir('./'):
if filename in file:
filename = file
if '.ts' in filename:
program = "ts-node"
elif '.js' in filename:
program = "node"
else:
program = "node"
with open(f"./test/logs/{filename.split('.')[0]}-{index}.log", 'w') as f:
f.truncate(0)
os.system(f"{program} {filename} {quote(ck)} >> ./test/logs/{filename.split('.')[0]}-{index}.log &")
print('done')
if __name__ == '__main__':
print(sys.argv)
get_cookies()
for i in range(len(cookies)):
threading.Thread(target=main, args=(cookies[i], i)).start()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/issuns/jd_scripts.git
git@gitee.com:issuns/jd_scripts.git
issuns
jd_scripts
jd_scripts
main

搜索帮助