mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-04 00:44:07 +08:00
update
This commit is contained in:
@@ -28,7 +28,7 @@ if not ipport:
|
||||
ipport = "localhost:5700"
|
||||
else:
|
||||
ipport = ipport.lstrip("http://").rstrip("/")
|
||||
sub_str = os.getenv("RES_SUB", "shufflewzc_faker3")
|
||||
sub_str = os.getenv("RES_SUB", "shufflewzc_faker2")
|
||||
sub_list = sub_str.split("&")
|
||||
res_only = os.getenv("RES_ONLY", True)
|
||||
headers = {
|
||||
@@ -83,6 +83,17 @@ def get_index(lst: list, item: str) -> list:
|
||||
return [index for (index, value) in enumerate(lst) if value == item]
|
||||
|
||||
|
||||
def getversion():
|
||||
url = f"http://{ipport}/api/system"
|
||||
response = requests.get(url=url)
|
||||
data = json.loads(response.content.decode("utf-8"))
|
||||
version = data.get("data").get("version")
|
||||
if int(version.split('.')[0]) >= 2:
|
||||
if int(version.split('.')[1]) >= 12:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def get_duplicate_list(tasklist: list) -> tuple:
|
||||
logger.info("\n=== 第一轮初筛开始 ===")
|
||||
|
||||
@@ -90,6 +101,9 @@ def get_duplicate_list(tasklist: list) -> tuple:
|
||||
names = []
|
||||
cmds = []
|
||||
for task in tasklist:
|
||||
if getversion() == 1:
|
||||
ids.append(task.get("id"))
|
||||
else:
|
||||
ids.append(task.get("_id"))
|
||||
names.append(task.get("name"))
|
||||
cmds.append(task.get("command"))
|
||||
@@ -155,6 +169,10 @@ def disable_duplicate_tasks(ids: list) -> None:
|
||||
|
||||
def get_token() -> str or None:
|
||||
try:
|
||||
if getversion() == 1:
|
||||
with open("/ql/data/config/auth.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
else:
|
||||
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
except Exception:
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
"""
|
||||
cron: 50 * * * *
|
||||
new Env('禁用重复任务青龙2.12版本');
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
||||
import requests
|
||||
|
||||
logger = logging.getLogger(name=None) # 创建一个日志对象
|
||||
logging.Formatter("%(message)s") # 日志内容格式化
|
||||
logger.setLevel(logging.INFO) # 设置日志等级
|
||||
logger.addHandler(logging.StreamHandler()) # 添加控制台日志
|
||||
# logger.addHandler(logging.FileHandler(filename="text.log", mode="w")) # 添加文件日志
|
||||
|
||||
|
||||
ipport = os.getenv("IPPORT")
|
||||
if not ipport:
|
||||
logger.info(
|
||||
"如果报错请在环境变量中添加你的真实 IP:端口\n名称:IPPORT\t值:127.0.0.1:5700\n或在 config.sh 中添加 export IPPORT='127.0.0.1:5700'"
|
||||
)
|
||||
ipport = "localhost:5700"
|
||||
else:
|
||||
ipport = ipport.lstrip("http://").rstrip("/")
|
||||
sub_str = os.getenv("RES_SUB", "shufflewzc_faker2")
|
||||
sub_list = sub_str.split("&")
|
||||
res_only = os.getenv("RES_ONLY", True)
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
|
||||
}
|
||||
|
||||
|
||||
def load_send() -> None:
|
||||
logger.info("加载推送功能中...")
|
||||
global send
|
||||
send = None
|
||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.append(cur_path)
|
||||
if os.path.exists(cur_path + "/notify.py"):
|
||||
try:
|
||||
from notify import send
|
||||
except Exception:
|
||||
send = None
|
||||
logger.info(f"❌加载通知服务失败!!!\n{traceback.format_exc()}")
|
||||
|
||||
|
||||
def get_tasklist() -> list:
|
||||
tasklist = []
|
||||
t = round(time.time() * 1000)
|
||||
url = f"http://{ipport}/api/crons?searchValue=&t={t}"
|
||||
response = requests.get(url=url, headers=headers)
|
||||
datas = json.loads(response.content.decode("utf-8"))
|
||||
if datas.get("code") == 200:
|
||||
tasklist = datas.get("data")
|
||||
return tasklist
|
||||
|
||||
|
||||
def filter_res_sub(tasklist: list) -> tuple:
|
||||
filter_list = []
|
||||
res_list = []
|
||||
for task in tasklist:
|
||||
for sub in sub_list:
|
||||
if task.get("command").find(sub) == -1:
|
||||
flag = False
|
||||
else:
|
||||
flag = True
|
||||
break
|
||||
if flag:
|
||||
res_list.append(task)
|
||||
else:
|
||||
filter_list.append(task)
|
||||
return filter_list, res_list
|
||||
|
||||
|
||||
def get_index(lst: list, item: str) -> list:
|
||||
return [index for (index, value) in enumerate(lst) if value == item]
|
||||
|
||||
|
||||
def get_duplicate_list(tasklist: list) -> tuple:
|
||||
logger.info("\n=== 第一轮初筛开始 ===")
|
||||
|
||||
ids = []
|
||||
names = []
|
||||
cmds = []
|
||||
for task in tasklist:
|
||||
ids.append(task.get("id"))
|
||||
names.append(task.get("name"))
|
||||
cmds.append(task.get("command"))
|
||||
|
||||
name_list = []
|
||||
for i, name in enumerate(names):
|
||||
if name not in name_list:
|
||||
name_list.append(name)
|
||||
|
||||
tem_tasks = []
|
||||
temids = []
|
||||
dupids = []
|
||||
for name2 in name_list:
|
||||
name_index = get_index(names, name2)
|
||||
for i in range(len(name_index)):
|
||||
if i == 0:
|
||||
logger.info(f"【✅保留】{cmds[name_index[0]]}")
|
||||
tem_tasks.append(tasklist[name_index[0]])
|
||||
temids.append(ids[name_index[0]])
|
||||
else:
|
||||
logger.info(f"【🚫禁用】{cmds[name_index[i]]}")
|
||||
dupids.append(ids[name_index[i]])
|
||||
logger.info("")
|
||||
|
||||
logger.info("=== 第一轮初筛结束 ===")
|
||||
|
||||
return temids, tem_tasks, dupids
|
||||
|
||||
|
||||
def reserve_task_only(
|
||||
temids: list, tem_tasks: list, dupids: list, res_list: list
|
||||
) -> list:
|
||||
if len(temids) == 0:
|
||||
return temids
|
||||
|
||||
logger.info("\n=== 最终筛选开始 ===")
|
||||
task3 = None
|
||||
for task1 in tem_tasks:
|
||||
for task2 in res_list:
|
||||
if task1.get("name") == task2.get("name"):
|
||||
dupids.append(task1.get("id"))
|
||||
logger.info(f"【✅保留】{task2.get('command')}")
|
||||
task3 = task1
|
||||
if task3:
|
||||
logger.info(f"【🚫禁用】{task3.get('command')}\n")
|
||||
task3 = None
|
||||
logger.info("=== 最终筛选结束 ===")
|
||||
return dupids
|
||||
|
||||
|
||||
def disable_duplicate_tasks(ids: list) -> None:
|
||||
t = round(time.time() * 1000)
|
||||
url = f"http://{ipport}/api/crons/disable?t={t}"
|
||||
data = json.dumps(ids)
|
||||
headers["Content-Type"] = "application/json;charset=UTF-8"
|
||||
response = requests.put(url=url, headers=headers, data=data)
|
||||
datas = json.loads(response.content.decode("utf-8"))
|
||||
if datas.get("code") != 200:
|
||||
logger.info(f"❌出错!!!错误信息为:{datas}")
|
||||
else:
|
||||
logger.info("🎉成功禁用重复任务~")
|
||||
|
||||
|
||||
def get_token() -> str or None:
|
||||
try:
|
||||
with open("/ql/data/config/auth.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
except FileNotFoundError:
|
||||
with open("/ql/config/auth.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
except Exception:
|
||||
logger.info(f"❌无法获取 token!!!\n{traceback.format_exc()}")
|
||||
send("💔禁用重复任务失败", "无法获取 token!!!")
|
||||
exit(1)
|
||||
return data.get("token")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger.info("===> 禁用重复任务开始 <===")
|
||||
load_send()
|
||||
token = get_token()
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
|
||||
# 获取过滤后的任务列表
|
||||
sub_str = "\n".join(sub_list)
|
||||
logger.info(f"\n=== 你选择过滤的任务前缀为 ===\n{sub_str}")
|
||||
tasklist = get_tasklist()
|
||||
if len(tasklist) == 0:
|
||||
logger.info("❌无法获取 tasklist!!!")
|
||||
exit(1)
|
||||
filter_list, res_list = filter_res_sub(tasklist)
|
||||
|
||||
temids, tem_tasks, dupids = get_duplicate_list(filter_list)
|
||||
# 是否在重复任务中只保留设置的前缀
|
||||
if res_only:
|
||||
ids = reserve_task_only(temids, tem_tasks, dupids, res_list)
|
||||
else:
|
||||
ids = dupids
|
||||
logger.info("你选择保留除了设置的前缀以外的其他任务")
|
||||
|
||||
sum = f"所有任务数量为:{len(tasklist)}"
|
||||
filter = f"过滤的任务数量为:{len(res_list)}"
|
||||
disable = f"禁用的任务数量为:{len(ids)}"
|
||||
logging.info("\n=== 禁用数量统计 ===\n" + sum + "\n" + filter + "\n" + disable)
|
||||
|
||||
if len(ids) == 0:
|
||||
logger.info("😁没有重复任务~")
|
||||
else:
|
||||
disable_duplicate_tasks(ids)
|
||||
if send:
|
||||
send("💖禁用重复任务成功", f"\n{sum}\n{filter}\n{disable}")
|
||||
31
jd_jdzz.js
31
jd_jdzz.js
@@ -1,22 +1,18 @@
|
||||
/*
|
||||
京东赚赚
|
||||
可以做随机互助
|
||||
活动入口:京东赚赚小程序
|
||||
长期活动,每日收益2毛左右,多号互助会较多
|
||||
长期活动,每日收益2毛左右
|
||||
已支持IOS双京东账号,Node.js支持N个京东账号
|
||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
# 京东赚赚
|
||||
10 0 * * * jd_jdzz.js, tag=京东赚赚, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzz.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "10 0 * * *" script-path=jd_jdzz.js,tag=京东赚赚
|
||||
|
||||
===============Surge=================
|
||||
京东赚赚 = type=cron,cronexp="10 0 * * *",wake-system=1,timeout=3600,script-path=jd_jdzz.js
|
||||
|
||||
============小火箭=========
|
||||
京东赚赚 = type=cron,script-path=jd_jdzz.js, cronexpr="10 0 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
@@ -24,7 +20,7 @@ const $ = new Env('京东赚赚');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
let helpAuthor = true; // 帮助作者
|
||||
//let helpAuthor = true; // 帮助作者
|
||||
const randomCount = $.isNode() ? 20 : 5;
|
||||
let jdNotify = true; // 是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
@@ -40,11 +36,11 @@ if ($.isNode()) {
|
||||
}
|
||||
const JD_API_HOST = 'https://api.m.jd.com/client.action';
|
||||
const inviteCodes = [
|
||||
``
|
||||
''
|
||||
]
|
||||
let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000);
|
||||
!(async () => {
|
||||
await requireConfig();
|
||||
//await requireConfig();
|
||||
if (!cookiesArr[0]) {
|
||||
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||
return;
|
||||
@@ -67,7 +63,7 @@ let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset() *
|
||||
}
|
||||
continue
|
||||
}
|
||||
await shareCodesFormat()
|
||||
//await shareCodesFormat()
|
||||
await jdWish()
|
||||
}
|
||||
}
|
||||
@@ -98,12 +94,16 @@ async function jdWish() {
|
||||
$.nowNum = parseInt($.totalNum)
|
||||
for (let i = 0; i < $.taskList.length; ++i) {
|
||||
let task = $.taskList[i]
|
||||
if (task['taskId'] !== 3 && task['status'] !== 2) {
|
||||
// console.log(task);
|
||||
if (task['taskId'] === 1 && task['status'] !== 2) {
|
||||
console.log(`去做任务:${task.taskName}`)
|
||||
await doTask({ "taskId": task['taskId'], "taskItem": {}, "actionType": 0, "taskToken": task['taskToken'], "mpVersion": "3.4.0" })
|
||||
} else if (task['taskId'] !== 3 && task['status'] !== 2) {
|
||||
console.log(`去做任务:${task.taskName}`)
|
||||
if (task['itemId'])
|
||||
await doTask({ "itemId": task['itemId'], "taskId": task['taskId'], "taskToken": task["taskToken"], "mpVersion": "3.4.0" })
|
||||
await doTask({ "itemId": task['itemId'], "taskId": task['taskId'], "taskItem": {}, "actionType": 0, "taskToken": task['taskToken'], "mpVersion": "3.4.0" })
|
||||
else
|
||||
await doTask({ "taskId": task['taskId'], "taskToken": task["taskToken"], "mpVersion": "3.4.0" })
|
||||
await doTask({ "taskId": task['taskId'], "taskItem": {}, "actionType": 0, "taskToken": task['taskToken'], "mpVersion": "3.4.0" })
|
||||
await $.wait(3000)
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ function getUserInfo() {
|
||||
|
||||
function getTaskList(flag = false) {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl("interactTaskIndex"), async (err, resp, data) => {
|
||||
$.get(taskUrl("interactTaskIndex", { "mpVersion": "3.4.0" }), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@@ -164,11 +164,8 @@ function getTaskList(flag = false) {
|
||||
} else {
|
||||
if (safeGet(data)) {
|
||||
data = JSON.parse(data);
|
||||
$.taskList = data.data.taskDetailResList
|
||||
$.totalNum = data.data.totalNum
|
||||
$.taskList = data?.data?.taskDetailResList ?? []
|
||||
if (data.data.signTaskRes) {
|
||||
$.taskList.push(data.data.signTaskRes)
|
||||
}
|
||||
$.totalBeanNum = data.data.totalBeanNum
|
||||
if (flag && $.taskList.filter(item => !!item && item['taskId'] === 3) && $.taskList.filter(item => !!item && item['taskId'] === 3).length) {
|
||||
console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId'] === 3)[0]['itemId']}\n`);
|
||||
|
||||
File diff suppressed because one or more lines are too long
128
jd_wish.js
128
jd_wish.js
File diff suppressed because one or more lines are too long
14
magic.js
14
magic.js
@@ -209,7 +209,7 @@ class Env {
|
||||
this.cookie = cookie;
|
||||
this.username = decodeURIComponent(
|
||||
cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||
$.defaults.headers['Cookie'] = this.cookie;
|
||||
$.defaults.headers['Cookie'] = this.cookie;17840
|
||||
this.index = i + 1;
|
||||
try {
|
||||
await this.logic()
|
||||
@@ -850,17 +850,6 @@ class Env {
|
||||
}
|
||||
|
||||
async sign(fn, body = {}) {
|
||||
if ('isvObfuscator'===fn){
|
||||
let b = {"functionId": fn, "body": JSON.stringify(body)};
|
||||
let h= {"Content-Type": "application/json","Cookie":"HELLO WORLD"}
|
||||
try {
|
||||
let {data} = await this.request('https://api.lfyouse.org/jdsign', h, b);
|
||||
console.log(data)
|
||||
return {fn: fn, sign: data};
|
||||
} catch (e) {
|
||||
console.log("isvObfuscator sign接口异常")
|
||||
}
|
||||
}else {
|
||||
let b = {"fn": fn, "body": body};
|
||||
let h = {"token": apiToken}
|
||||
try {
|
||||
@@ -871,7 +860,6 @@ class Env {
|
||||
}
|
||||
return {fn: "", sign: ""};
|
||||
}
|
||||
}
|
||||
|
||||
async _algo() {
|
||||
if (this.appId.length === 2) {
|
||||
|
||||
Reference in New Issue
Block a user