我发现安知鱼的音乐配置根本就找不到说明就无奈自己逆向了一下,找到了配置文件,写在博客里记录一下也算是给大家避坑
我的版本是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"字段去找配置项即可