2026年2月16日星期一

New Automated 360 Community Daily Sign-in Script Guide

Summary: A guide for an automated sign-in script for the 360 Community. It covers purchasing cloud servers (Alibaba, Tencent, Huawei), deployment using Qinglong Panel, and the Python script's logic for session reuse and automatic sign-in. The script includes login handling, sign-in execution, and fallback methods.

1.购买服务器

阿里云:

服务器购买地址

https://t.aliyun.com/U/G61mcO

若失效,可用地址

https://www.aliyun.com/benefit?source=5176.29345612&userCode=49hts92d

腾讯云:

https://curl.qcloud.com/wJpWmSfU

若失效,可用地址

https://cloud.tencent.com/act/cps/redirect?redirect=2446&cps_key=ad201ee2ef3b771157f72ee5464b1fea&from=console

华为云

https://activity.huaweicloud.com/cps.html?fromacct=64b5cf7cc11b4840bb4ed2ea0b2f4468&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905

2.部署教程

2024年最新青龙面板跑脚本教程(一)持续更新中

3.代码如下

import refrom pathlib import Pathfrom playwright.sync_api import sync_playwright, TimeoutError as PWTimeoutError

class Qihu360BbsSigner:
    SIGN_URL = "https://bbs.360.cn/dsu_paulsign-sign.html"    ALT_SIGN_URL = "https://bbs.360.cn/plugin.php?id=dsu_paulsign:sign"    STATE_PATH = Path("bbs360_storage_state.json")
    def __init__(self, headless: bool = False, slow_mo_ms: int = 50):        self.headless = headless        self.slow_mo_ms = slow_mo_ms
    @staticmethod    def _has_logged_in_hint(page) -> bool:        # 粗判断:未登录页常出现"请使用手机微信扫码安全登录/切换账号密码登录/您需要先登录"等        html = page.content()        return not any(k in html for k in ["您需要先登录""扫码安全登录""切换账号密码登录""登录 注册"])
    @staticmethod    def _click_by_text(page, texts, timeout_ms=3000) -> bool:        for t in texts:            locs = [                page.get_by_role("button", name=re.compile(t)),                page.get_by_role("link", name=re.compile(t)),                page.locator(f"text={t}"),                page.locator(f"input[value*='{t}']"),            ]            for loc in locs:                try:                    if loc.first.is_visible(timeout=timeout_ms):                        loc.first.click(timeout=timeout_ms)                        return True                except Exception:                    continue        return False
    def ensure_login(self, page, context) -> None:        # 打开签到页(更容易触发登录跳转)        page.goto(self.SIGN_URL, wait_until="domcontentloaded")        page.wait_for_timeout(1200)
        if self._has_logged_in_hint(page):            print("[login] 看起来已登录(或已有有效登录态)。")            return
        # 未登录:引导你手动登录(可能跳 i.360.cn)        self._click_by_text(page, ["登录""切换账号密码登录"])        page.wait_for_timeout(1200)
        print("[login] 请在打开的浏览器里手动完成 360 账号登录/绑定手机号等要求(如有验证码请正常验证)。")        input("      登录完成后回到终端按回车继续...")
        context.storage_state(path=str(self.STATE_PATH))        print(f"[login] 登录态已保存:{self.STATE_PATH.resolve()}")
    def do_sign(self, page) -> bool:        # 进入签到页        page.goto(self.SIGN_URL, wait_until="domcontentloaded")        page.wait_for_timeout(1500)
        # 已签到/成功提示(不同样式文案可能不同)        html = page.content()        if any(k in html for k in ["已签到""今日已签到""签到成功"]):            print("[sign] 页面显示:已签到/今日已签到。")            return True
        # 尝试点击"签到/立即签到/开始签到"        clicked = self._click_by_text(page, ["签到""立即签到""开始签到""一键签到"], timeout_ms=4000)        page.wait_for_timeout(1500)
        html2 = page.content()        if any(k in html2 for k in ["已签到""今日已签到""签到成功"]):            print("[sign] 签到成功/已签到。")            return True
        if clicked:            print("[sign] 已执行点击动作,但未识别到明确成功提示;建议你肉眼确认页面是否显示已签到。")            return True
        # 兜底:换入口再试一次        page.goto(self.ALT_SIGN_URL, wait_until="domcontentloaded")        page.wait_for_timeout(1500)        clicked2 = self._click_by_text(page, ["签到""立即签到""开始签到"], timeout_ms=4000)        page.wait_for_timeout(1500)
        html3 = page.content()        if any(k in html3 for k in ["已签到""今日已签到""签到成功"]):            print("[sign] 签到成功/已签到(备用入口)。")            return True
        if clicked2:            print("[sign] 备用入口已点击,但未识别到明确成功提示;建议肉眼确认。")            return True
        print("[sign] 未找到签到按钮/入口(可能页面结构改版或需要先完成手机号绑定等条件)。")        return False
    def run(self) -> None:        with sync_playwright() as p:            browser = p.chromium.launch(headless=self.headless, slow_mo=self.slow_mo_ms)            context = browser.new_context(                storage_state=str(self.STATE_PATH) if self.STATE_PATH.exists() else None            )            page = context.new_page()
            try:                self.ensure_login(page, context)                ok = self.do_sign(page)
                # 保存最新 token/cookie(避免刷新后丢)                context.storage_state(path=str(self.STATE_PATH))                print("[done] 结束。结果:""已尝试签到" if ok else "未完成签到")
            except PWTimeoutError as e:                print("[error] 页面等待超时:", e)            finally:                context.close()                browser.close()

if __name__ == "__main__":    # 可视化运行更稳,方便你确认"已签到"    Qihu360BbsSigner(headless=False, slow_mo_ms=50).run()
解析

该脚本为360社区自动签到脚本,主要作用包括:

  1. 复用登录态:首次你手动完成 360 登录/绑定要求后,脚本保存 bbs360_storage_state.json;后续运行直接复用。

  2. 自动进入"每日签到"页面并执行签到:打开 dsu_paulsign-sign.html(或备用入口),点击"签到/立即签到",并识别"已签到/签到成功"。

主要方法

  • ensure_login():打开签到页判断是否未登录;若未登录,引导你手动完成登录(合规方式),并保存登录态。

  • do_sign():进入签到页 → 判断是否已签到 → 自动点击"签到"按钮 → 再次判断是否成功;失败则用备用入口再试一次。

  • run():串联流程,并在退出前再次保存登录态,避免 cookie/token 刷新后丢失。



注意

本文部分变量已做脱敏处理,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。技术层面需要提供帮助,可以通过打赏的方式进行探讨。


历史脚本txt文件获取>>
服务器搭建,人工服务咨询>>

没有评论:

发表评论

New Automated 360 Community Daily Sign-in Script Guide

Summary: A guide for an automated sign-in script for the 360 Community. It covers purchasing cloud servers (Alibaba, Tencent, Huawei), deplo...