收起左侧

【青龙面板】使用脚本每天自动签到蓝光演唱会资源网站,每天"赚"两块

12
回复
2363
查看
[ 复制链接 ]

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-2-22 18:28:21 显示全部楼层 阅读模式

25年9月有更新,获取新版代码,请翻到帖子底部

偶然发现一个资源质量很高的网站 蓝光演唱会:https://www.lgych.com/,里面有很多高清演唱会视频和无损音乐。你可以购买金币支持,也可以通过签到获取金币后白嫖,由于该网站金币跟RMB是1:1兑换,我感觉有点贵。感觉很适合写个脚本挂到青龙面板。

重要:进入本贴则默认你的青龙面板已经成功安装并配置所有常见环境依赖,不解答相关问题。

脚本中仅需填入两个内容,网站Cookie和推送Token

登陆网站后,按F12打开网页控制台,如图获取关键Cookie信息,填入代码中

image.png

推送Token也不做介绍了,在pushplus官网即可免费获取Token,然后填入代码中。

不填也不会影响签到,只是没有微信推送。

旧版代码:

import requests
import re
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry

# 配置
SIGN_IN_URL = "https://www.lgych.com/wp-content/themes/modown/action/user.php"  # 签到接口
USER_PAGE_URL = "https://www.lgych.com/user"  # 用户信息页面
cookies = {
    "wordpress_logged_in_c31b215c0db6cdb6478d719de4022ec2": "" #此处双引号中的内容 需要从浏览器F12抓包并复制,然后填入代码中
}
headers = {
    "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    "x-requested-with": "XMLHttpRequest"
}
data = {"action": "user.checkin"}
push_config = {
    "API_URL": "https://www.pushplus.plus/send",
    "TOKEN": "" #此处双引号中,应填入pushplus服务的token,不填则不推送,不影响签到成功
}

def pushplus_push(title: str, content: str):
    payload = {
        "token": push_config["TOKEN"],
        "title": title,
        "content": content,
        "template": "html"
    }
    response = requests.post(push_config["API_URL"], json=payload, headers={"Content-Type": "application/json"})
    if response.status_code == 200:
        print("PushPlus 推送成功!")

def get_user_info():
    try:
        response = requests.get(USER_PAGE_URL, headers=headers, cookies=cookies)
        if response.status_code == 200:
            html_content = response.text
            # 提取可用积分
            points_match = re.search(r"可用积分:(\d+)", html_content)
            points = points_match.group(1) if points_match else "无法获取"
            # 提取金币余额
            gold_match = re.search(r'<b class="color">(\d+\.\d{2})</b>\s*金币', html_content)
            gold = gold_match.group(1) if gold_match else "无法获取"
            return points, gold
        else:
            print(f"获取用户信息页面失败,状态码: {response.status_code}")
    except Exception as e:
        print(f"获取用户信息异常: {e}")
    return "无法获取", "无法获取"

def sign_in():
    try:
        # 创建带有重试机制的会话
        session = requests.Session()
        retries = Retry(total=3, backoff_factor=1, status_forcelist=[502, 503, 504])
        session.mount("https://", HTTPAdapter(max_retries=retries))

        # 执行签到操作
        response = session.post(SIGN_IN_URL, headers=headers, cookies=cookies, data=data)
        if response.status_code == 200:
            result_text = response.text.encode().decode('unicode_escape')
            print("签到接口返回内容:", result_text)

            # 尝试访问用户页面获取额外奖励
            user_page_response = session.get(USER_PAGE_URL, headers=headers, cookies=cookies)
            if user_page_response.status_code == 200:
                extra_reward_status = "成功访问用户页面,获取额外奖励。"
            else:
                extra_reward_status = f"访问用户页面失败,状态码: {user_page_response.status_code}"

            # 获取积分和金币余额
            points, gold = get_user_info()

            # 根据签到结果推送信息
            if "金币" in result_text:
                print("签到成功!")
                pushplus_push("蓝光演唱会签到成功", f"签到成功!当前可用积分:{points},金币余额:{gold}金币。{extra_reward_status}")
            elif "已经" in result_text:
                print("已签到过")
                pushplus_push("蓝光演唱会已签到过", f"已签到过。当前可用积分:{points},金币余额:{gold}金币。{extra_reward_status}")
            else:
                print("签到失败:未知原因。")
                pushplus_push("蓝光演唱会签到失败", f"签到失败,原因未知。返回内容: {result_text}")
        else:
            print(f"签到请求失败,状态码: {response.status_code}")
            pushplus_push("蓝光演唱会签到失败", f"签到请求失败,状态码: {response.status_code}")
    except Exception as error:
        print("签到或访问用户页面请求异常:", error)
        pushplus_push("蓝光演唱会签到或访问用户页面失败", f"签到或访问用户页面请求异常: {error}")

if __name__ == "__main__":
    sign_in()

脚本自身没写定时逻辑,需要你在青龙配置定时任务,我的定时cron表达式是 1 8 * * *

意思是每天早上08:01执行(本来所有脚本都是8点整,但是发现推送接口 同时请求太多容易报错,所以改成错开1分钟 发表帖子

image.png


新版代码(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()
收藏
送赞 1
分享

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

1

主题

24

回帖

0

牛值

江湖小虾

2025-2-25 13:49:55 显示全部楼层
感想分享
记忆是一种相会,遗忘是一种自由。 ---纪伯伦-

3

主题

17

回帖

0

牛值

江湖小虾

2025-3-18 17:58:42 显示全部楼层
./演唱会.swap: line 1: import: command not found
./演唱会.swap: line 2: import: command not found
./演唱会.swap: line 3: from: command not found
./演唱会.swap: line 4: from: command not found
./演唱会.swap: line 7: SIGN_IN_URL: command not found
./演唱会.swap: line 8: USER_PAGE_URL: command not found
./演唱会.swap: line 9: cookies: command not found
./演唱会.swap: line 10: wordpress_logged_in_c31b215c0db6cdb6478d719de4022ec2:: command not found
./演唱会.swap: line 11: syntax error near unexpected token `}'
./演唱会.swap: line 11: `}'

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-3-18 18:03:38 楼主 显示全部楼层
这是python代码,文件名后缀要用py。
你这个swap是啥

9

主题

13

回帖

0

牛值

江湖小虾

2025-3-31 09:38:11 显示全部楼层

ai改了个 Server酱版本,能用,这个蓝光的cookie每5-7天就会变 需要重新配置,大家有这个问题吗

import requests
import re
import os
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry

# 配置
SIGN_IN_URL = "https://www.lgych.com/wp-content/themes/modown/action/user.php"  # 签到接口
USER_PAGE_URL = "https://www.lgych.com/user"  # 用户信息页面
cookies = {
    "wordpress_logged_in_c31b215c0db6cdb6478d719de4022ec2": "" #此处双引号中的内容 需要从浏览器F12抓包并复制,然后填入代码中
}
headers = {
    "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    "x-requested-with": "XMLHttpRequest"
}
data = {"action": "user.checkin"}

def serverchan_push(title: str, content: str):
    push_key = os.environ.get("PUSH_KEY_lgych")
    if not push_key:
        print("Server酱推送密钥未配置,请检查环境变量PUSH_KEY_lgych")
        return

    api_url = f"https://sctapi.ftqq.com/{push_key}.send"
    payload = {
        "title": title,
        "desp": content
    }
    try:
        response = requests.post(api_url, data=payload)
        result = response.json()
        if response.status_code == 200 and result.get("code") == 0:
            print("Server酱推送成功!")
        else:
            print(f"Server酱推送失败,错误信息:{result.get('message')}")
    except Exception as e:
        print(f"Server酱推送请求异常: {e}")

def get_user_info():
    try:
        response = requests.get(USER_PAGE_URL, headers=headers, cookies=cookies)
        if response.status_code == 200:
            html_content = response.text
            # 提取可用积分
            points_match = re.search(r"可用积分:(\d+)", html_content)
            points = points_match.group(1) if points_match else "无法获取"
            # 提取金币余额
            gold_match = re.search(r'<b class="color">(\d+\.\d{2})</b>\s*金币', html_content)
            gold = gold_match.group(1) if gold_match else "无法获取"
            return points, gold
        else:
            print(f"获取用户信息页面失败,状态码: {response.status_code}")
    except Exception as e:
        print(f"获取用户信息异常: {e}")
    return "无法获取", "无法获取"

def sign_in():
    try:
        # 创建带有重试机制的会话
        session = requests.Session()
        retries = Retry(total=3, backoff_factor=1, status_forcelist=[502, 503, 504])
        session.mount("https://", HTTPAdapter(max_retries=retries))

        # 执行签到操作
        response = session.post(SIGN_IN_URL, headers=headers, cookies=cookies, data=data)
        if response.status_code == 200:
            result_text = response.text.encode().decode('unicode_escape')
            print("签到接口返回内容:", result_text)

            # 尝试访问用户页面获取额外奖励
            user_page_response = session.get(USER_PAGE_URL, headers=headers, cookies=cookies)
            if user_page_response.status_code == 200:
                extra_reward_status = "成功访问用户页面,获取额外奖励。"
            else:
                extra_reward_status = f"访问用户页面失败,状态码: {user_page_response.status_code}"

            # 获取积分和金币余额
            points, gold = get_user_info()

            # 根据签到结果推送信息
            if "金币" in result_text:
                print("签到成功!")
                serverchan_push("蓝光演唱会签到成功", f"签到成功!当前可用积分:{points},金币余额:{gold}金币。{extra_reward_status}")
            elif "已经" in result_text:
                print("已签到过")
                serverchan_push("蓝光演唱会已签到过", f"已签到过。当前可用积分:{points},金币余额:{gold}金币。{extra_reward_status}")
            else:
                print("签到失败:未知原因。")
                serverchan_push("蓝光演唱会签到失败", f"签到失败,原因未知。返回内容: {result_text}")
        else:
            print(f"签到请求失败,状态码: {response.status_code}")
            serverchan_push("蓝光演唱会签到失败", f"签到请求失败,状态码: {response.status_code}")
    except Exception as error:
        print("签到或访问用户页面请求异常:", error)
        serverchan_push("蓝光演唱会签到或访问用户页面失败", f"签到或访问用户页面请求异常: {error}")

if __name__ == "__main__":
    sign_in()
的确是这样,cookie每7天过期。自动登录不太好搞 有登录验证码  详情 回复
2025-4-1 14:25

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-4-1 14:25:58 楼主 显示全部楼层
大Cx 发表于 2025-3-31 09:38
[md]ai改了个 `Server酱`版本,能用,这个蓝光的cookie每5-7天就会变 需要重新配置,大家有这个问题吗

``` ...

的确是这样,cookie每7天过期。自动登录不太好搞 有登录验证码

0

主题

4

回帖

0

牛值

江湖小虾

2025-9-10 04:49:49 显示全部楼层

可以用api识别验证码,然后进行登录,cookie就一直有效了

嗯嗯,我已经改了,有空更新一下  详情 回复
2025-9-10 15:42

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-9-10 15:42:07 楼主 显示全部楼层
kevencs 发表于 2025-9-10 04:49
可以用api识别验证码,然后进行登录,cookie就一直有效了

嗯嗯,我已经改了,有空更新一下

0

主题

6

回帖

0

牛值

江湖小虾

2025-9-15 11:27:32 显示全部楼层

不能提现?

我说了可以提现?  详情 回复
2025-9-16 10:16

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-9-16 10:16:55 楼主 显示全部楼层

我说了可以提现?

0

主题

2

回帖

0

牛值

江湖小虾

2025-10-2 00:02:43 显示全部楼层

开始执行... 2025-10-02 00:01:12

File "/ql/data/scripts/lgych.py", line 25
requests.post(
^
IndentationError: expected an indented block after function definition on line 24

执行结束... 2025-10-02 00:01:12 耗时 1 秒     

请教一下这是什么问题?

青龙面板里,相关python依赖都安装了吗  详情 回复
2025-10-23 14:42

10

主题

106

回帖

0

牛值

fnOS系统内测组

2025-10-23 14:42:22 楼主 显示全部楼层
13077986138 发表于 2025-10-2 00:02
开始执行... 2025-10-02 00:01:12
File &quot;/ql/data/scripts/lgych.py&quot;, line 25
requests.post(

青龙面板里,相关python依赖都安装了吗

1

主题

4

回帖

0

牛值

江湖小虾

webdriver装不上,怎么处理啊

开始安装依赖 webdriver,开始时间 2025-10-29 17:41:02

ERROR: Could not find a version that satisfies the requirement webdriver (from versions: none)
ERROR: No matching distribution found for webdriver

依赖安装失败,结束时间 2025-10-29 17:41:11,耗时 8 秒
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则