17
创建文件夹 然后新建文件 名字随意 后缀为括号内的 最后添加宝塔定时任务就行
python(xx.py)
ts// #!/usr/bin/env python3
import json
import os
import random
import sys
import time
import urllib.error
import urllib.request
API_URL = "https://www.nodeseek.com/api/attendance"
def load_env_file(path=".env"):
if not os.path.exists(path):
return
with open(path, "r", encoding="utf-8") as file:
for line in file:
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, value = line.split("=", 1)
key = key.strip()
value = value.strip().strip('"').strip("'")
os.environ.setdefault(key, value)
def env_bool(name, default=False):
value = os.getenv(name)
if value is None:
return default
return value.strip().lower() in {"1", "true", "yes", "y", "on"}
def build_headers(cookie):
return {
"User-Agent": "Mozilla/5.0",
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"Origin": "https://www.nodeseek.com",
"Referer": "https://www.nodeseek.com/board",
"Cookie": cookie,
}
def request_checkin(cookie, use_random=True, timeout=20):
random_text = "true" if use_random else "false"
url = f"{API_URL}?random={random_text}"
payload = json.dumps({"random": use_random}).encode("utf-8")
request = urllib.request.Request(
url=url,
data=payload,
env 填入cookie就行(.env)
ts// NODESEEK_COOKIE="..."
NODESEEK_RANDOM=true
NODESEEK_DELAY_MIN=0
NODESEEK_DELAY_MAX=0
宝塔任务
ts// cd /www/wwwroot/文件夹 && python3 文件名.py
什么也没有
回复讨论
0
登录后可参与回复讨论。
当前还没有回复,欢迎成为第一个参与讨论的人。
文明发言,理性讨论