2025年11月3日星期一

音乐磁场任务脚本

1.购买服务器阿里云:服务器购买地址https://t.aliyun.com/U/Bg6shY若失效,可用地址

1.购买服务器

阿里云:

服务器购买地址

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

若失效,可用地址

https://www.aliyun.com/daily-act/ecs/activity_selection?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.代码如下

# cron: 11 8 * * *import requestsimport re,os,sysimport timefrom notify import send
def pr(message):    msg.append(message + "\n" )    print(message)
msg = []def index(cookie): #验证登录     url = 'https://www.hifiti.com/index.htm'     header = {        "authority":"www.hifiti.com",        "method":"GET",        "path":"/index.htm",        "accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",        "User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",        "content-type""text/html; charset=utf-8; Cache-control:private",        "referer":"https://hifiti.com/user-login.htm",        "cookie":cookie    }     try:        response = requests.get(url=url,headers=header)        info = response.text        if "首页" in info:         pr("登陆成功")         sing(cookie)          else:         pr("登录失败")     except Exception as e:          pr(e)def sing(cookie):#验证是否签到     url = 'https://www.hifiti.com/sg_sign.htm'     header = {        "authority":"www.hifiti.com",        "method":"GET",        "path":"/sg_sign.htm",        "accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",        "User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",        "content-type""text/html; charset=utf-8; Cache-control:private",        "referer":"https://www.hifiti.com/",        "cookie":cookie    }
     try:        response = requests.get(url=url,headers=header)
        info = response.text
        if "已签" in info:           pr("您今天已经签到过了,请勿重复签到。")           my(cookie)        elif "签到" in info:
         pattern = re.compile(r'var sign = "(.*?)"')         matches = pattern.findall(info)         if not matches:          pr("解析用户信息失败,可能页面结构变化或 cookie 无效")          return         sgin = matches[0]         sing1(cookie,sgin)         time.sleep(3)         my(cookie)
        else :          pr("签到失败")
     except Exception as e:          pr(e)def sing1(cookie,sgin):#签到     url = 'https://www.hifiti.com/sg_sign.htm'     header = {        "authority":"www.hifiti.com",        "method":"POST",        "path":"/sg_sign.htm",        "accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",        "User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",        "referer":"https://www.hifiti.com/sg_sign.htm",        "cookie":cookie    }     data = {        "sign":sgin,     }     try:       response = requests.post(url=url,headers=header,data=data)       s1 = response.status_code        if s1 == 200 :          pr("签到成功")
       else:           pr("失败")
     except Exception as e:         pr(e)def my(cookie):#查询信息    url = 'https://www.hifiti.com/my.htm'    header = {        "authority":"www.hifiti.com",        "method":"GET",        "path":"/my.htm",        "User-Agent""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",        "referer":"https://www.hifiti.com/my-post.htm",        "cookie":cookie    }    try:       response = requests.get(url=url,headers=header)       info = response.text       if "基本资料" in info:
         pattern = re.compile(r'"view/img/avatar.png"> (.*?)</a></li>')         pattern2 = re.compile(r'金币:</span><b class="text-danger">(.*?)</b>')         matches = pattern.findall(info)         matches1 = pattern2.findall(info)         if not matches or not matches1:          pr("解析用户信息失败,可能页面结构变化或 cookie 无效")          return             pr( "用户名:" + matches[0] + " 金币" + matches1[0])       else:         pr("获取错误。"
    except Exception as e:         pr(e)


def sicxs():    config_path = 'config.py'    if os.path.exists(config_path):      import config      else:      with open(config_path, 'w'as f:         pr("首次运行,已创建配置文件 config.py,请按照说明填写相关变量后再次运行脚本。")        f.write('#可以在此文件中添加配置变量,例如:\nsfsy = ""\n')           try:        env_cookie = os.environ.get("wy_hifiti")        si_cookie = getattr(config, 'wy_hifiti'''        if env_cookie and si_cookie:            cookies = env_cookie + "\n" + si_cookie        elif env_cookie:            cookies = env_cookie        elif si_cookie:            cookies = si_cookie        else:            pr("请设置变量 export wy_hifiti='' 或在 config.py 中设置 wy_hifiti")            sys.exit()    except Exception as e:        pr("请设置变量 export wy_hifiti='' 或在 config.py 中设置 wy_hifiti")        sys.exit()    list_cookie = re.split(r'\n|&|@', cookies)    total_cookies = len(list_cookie)
    for i, list_cookie_i in enumerate(list_cookie):        print(f'\n----------- 账号【{i + 1}/{total_cookies}】执行 -----------')        pr(f"账号【{i + 1}】开始执行:")        try:            index(list_cookie_i)        except Exception as e:            pr(f"执行账号【{i + 1}】时发生错误: {e}")        finally:            send("音乐磁场"''.join(msg))            msg.clear()    print(f'\n-----------  执 行  结 束 -----------')
if __name__ == '__main__':  sicxs()

解析

该脚本为音乐磁场(hifiti.com)自动签到脚本。

主要作用

  • 信息查询脚本:利用传入的 cookie 登录站点,判断当日是否已签到;未签则提取签名参数并提交签到;最后进入个人中心页面抓取并输出用户名、金币等信息。

  • 多账号与通知:从环境变量或 config.py 读取多个账号(@&、换行分隔),逐个执行并通过 notify.send("音乐磁场", …) 推送结果;支持定时任务(cron: 11 8 * * *)。

主要方法

  • pr(message): 统一打印日志并追加到全局 msg,方便最终拼装通知文本。

  • index(cookie): 访问 https://www.hifiti.com/index.htm 验证登录成功与否;成功则进入 sing(cookie)

  • sing(cookie): 访问签到页 sg_sign.htm 判断状态:

    • 包含"已签"→ 已签到,转到 my(cookie) 查询资料;

    • 包含"签到"→ 用正则提取 var sign = "...",调用 sing1(cookie, sgin) 提交签到,稍等后再查 my(cookie)

    • 否则认为签到失败并记录日志。

  • sing1(cookie, sgin): 向 sg_sign.htm 发送 POST(表单字段 sign),HTTP 200 视为签到成功

  • my(cookie): 访问 my.htm,用正则提取用户名金币并输出;匹配失败提示"页面改版或 cookie 失效"。

  • sicxs()(主入口/调度):

    1. 初始化/创建 config.py

    2. 合并读取 wy_hifiti(环境变量与 config.py 中同名变量);

    3. 按 \n|&|@ 切分多账号,循环 index()

    4. 每个账号执行完发送一次通知并清空 msg


注意

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


历史脚本txt文件获取>>
服务器搭建,人工服务咨询>>
【历史脚本】
HiFiNi任务脚本(2025年9月版)

没有评论:

发表评论

我发现了一个能让普通人快速上手的赚钱秘密。但这个秘密,说出来可能会让很多“大佬”跳脚,因为它太简单,太不值钱了。

当我终于肯低下头,对自己说" 别装了, 你就是个普通人"的那一刻,心里那块一直压着的石头,反而"哐当"一声落地了。 没那个智商去预判风口,也没那个魅力让大佬带着我飞。 承认这点后,我整个人都轻松了。 我不再去做一夜暴富的梦,也不再关起门...