避坑:我找到了Hexo安知鱼的音乐馆配置(目前好像还没有教程)

我发现安知鱼的音乐配置根本就找不到说明就无奈自己逆向了一下,找到了配置文件,写在博客里记录一下也算是给大家避坑

我的版本是1.6.12,如果你和我的不一样可以看后面

配置文件就是Blog\themes\anzhiyu\source\js\utils.js

打开该文件,按Ctrl+F搜索 getCustomPlayList: function ()

这个函数内就是关于音乐源的设置,改成自己的就好:

  // 获取自定义播放列表
  getCustomPlayList: function () {
    if (!window.location.pathname.startsWith("/music/")) {
      return;
    }
    const urlParams = new URLSearchParams(window.location.search);
    const userId = "9921254541";
    const userServer = "netease";
    const anMusicPageMeting = document.getElementById("anMusic-page-meting");
    if (urlParams.get("id") && urlParams.get("server")) {
      const id = urlParams.get("id");
      const server = urlParams.get("server");
      anMusicPageMeting.innerHTML = `<meting-js id="${id}" server=${server} type="playlist" type="playlist" mutex="true" preload="auto" theme="var(--anzhiyu-main)" order="list" list-max-height="calc(100vh - 169px)!important"></meting-js>`;
    } else {
      anMusicPageMeting.innerHTML = `<meting-js id="${userId}" server="${userServer}" type="playlist" mutex="true" preload="auto" theme="var(--anzhiyu-main)" order="list" list-max-height="calc(100vh - 169px)!important"></meting-js>`;
    }
    anzhiyu.changeMusicBg(false);
  },

如果你和我的不一样,这里我写了一个可以遍历你的Blog文件夹下所有的文件,列出含有"anMusic-page"字段的文件路径的python脚本,我给出python代码:

import os  
  
def find_files_with_string_in_content(directory, search_string):  
    for root, dirs, files in os.walk(directory):  
        for file in files:  
            file_path = os.path.join(root, file)  
            try:  
                with open(file_path, 'r', encoding='utf-8', errors='ignore') as f:  
                    content = f.read()  
                    if search_string in content:  
                        print(file_path)  
            except Exception as e:  
                print(f"Error reading file {file_path}: {e}")  
  
if __name__ == "__main__":  
    directory_path = input("请输入要遍历的文件夹路径: ")  
    search_string = "#anMusic-page"  
    find_files_with_string_in_content(directory_path, search_string)

你需要向程序提供你的Blog文件根目录的绝对路径,将程序运行完输出的文件中列表中js或者pug等等后缀的类似文件逐个打开排查,打开文件找到"anMusic-page"字段去找配置项即可

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

中二电工吹短笛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值