偶然发现一个资源质量很高的网站 蓝光演唱会:https://www.lgych.com/,里面有很多高清演唱会视频和无损音乐。你可以购买金币支持,也可以通过签到获取金币后白嫖,由于该网站金币跟RMB是1:1兑换,我感觉有点贵。感觉很适合写个脚本挂到青龙面板。
重要:进入本贴则默认你的青龙面板已经成功安装并配置所有常见环境依赖,不解答相关问题。
脚本自身没写定时逻辑,需要你在青龙配置定时任务,我的定时cron表达式是 1 8 * * *
意思是每天早上08:01执行

签到代码(25年9月更新):
使用selenium登录,实现了全自动获取/复用/更新cookie,不再需要定期手动维护。
如果青龙面板中未安装selenium和webdriver,请先手动安装依赖,此处不作介绍。
PushPlus推送Token:点我注册
验证码识别Token:点我注册
import os, json, time, base64, re, requests
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
# -------------------- 敏感信息脱敏区 --------------------
USERNAME = "用户名"
PASSWORD = "密码"
PUSH_TOKEN = "推送TOKEN"
CAPTCHA_TOKEN = "验证码识别TOKEN"
# -------------------------------------------------------
LOGIN_URL = "https://www.lgych.com/login"
SIGN_IN_URL = "https://www.lgych.com/wp-content/themes/modown/action/user.php"
USER_PAGE_URL = "https://www.lgych.com/user"
HEADERS = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"x-requested-with": "XMLHttpRequest"
}
def push(title, content):
requests.post(
"https://www.pushplus.plus/send",
json={"token": PUSH_TOKEN, "title": title, "content": content, "template": "html"},
headers={"Content-Type": "application/json"}
)
def get_driver():
o = Options()
for a in ["--headless", "--no-sandbox", "--disable-dev-shm-usage",
"--disable-gpu", "--window-size=1920,1080"]:
o.add_argument(a)
return webdriver.Chrome(options=o)
def recognize(img_bytes):
res = requests.post(
"http://api.jfbym.com/api/YmServer/customApi",
json={"token": CAPTCHA_TOKEN, "type": "10110",
"image": base64.b64encode(img_bytes).decode()}
).json()
return res.get("data", {}).get("data") if res.get("code") == 10000 else None
def login():
driver = get_driver()
try:
driver.get(LOGIN_URL)
w = WebDriverWait(driver, 10)
w.until(EC.presence_of_element_located((By.ID, "username"))).send_keys(USERNAME)
driver.find_element(By.ID, "password").send_keys(PASSWORD)
for _ in range(3):
w.until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".captcha-clk2"))).click()
img = w.until(EC.presence_of_element_located((By.CSS_SELECTOR, ".captcha-img")))
code = recognize(img.screenshot_as_png)
if not code:
continue
driver.find_element(By.ID, "captcha").clear()
driver.find_element(By.ID, "captcha").send_keys(code)
driver.find_element(By.CSS_SELECTOR, ".submit").click()
time.sleep(3)
if "user" in driver.current_url:
cookies = driver.get_cookies()
json.dump(cookies, open("cookies.json", "w"), indent=2)
return cookies
finally:
driver.quit()
return None
def cookies2dict(cookies):
return {c["name"]: c["value"] for c in cookies}
def get_info(cookies):
html = requests.get(USER_PAGE_URL, headers=HEADERS, cookies=cookies).text
pts = re.search(r"可用积分:(\d+)", html)
gld = re.search(r'<b class="color">(\d+\.\d{2})</b>\s*金币', html)
return pts.group(1) if pts else "无法获取", gld.group(1) if gld else "无法获取"
def sign(cookies):
if not cookies:
return
r = requests.post(SIGN_IN_URL, headers=HEADERS, cookies=cookies, data={"action": "user.checkin"})
msg = r.text.encode().decode("unicode_escape")
pts, gld = get_info(cookies)
if "金币" in msg:
push("蓝光演唱会签到成功", f"签到成功!积分:{pts},金币:{gld}")
elif "已经" in msg:
push("蓝光演唱会已签到", f"已签到过。积分:{pts},金币:{gld}")
else:
push("蓝光演唱会签到异常", f"签到返回:{msg}")
def main():
cookies = json.load(open("cookies.json")) if os.path.exists("cookies.json") else None
if cookies and get_info(cookies2dict(cookies))[0] != "无法获取":
sign(cookies2dict(cookies))
else:
cookies = login()
if cookies:
sign(cookies2dict(cookies))
if __name__ == "__main__":
main()