Skip to content

Commit bac22c1

Browse files
committed
fix: 哔哩哔哩音乐地址错误
1 parent 20826b3 commit bac22c1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

zmusic-plugin/src/main/java/me/zhenxin/zmusic/ZMusic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public final class ZMusic {
2828

2929
public static File dataFolder;
3030
public static String thisVer;
31-
public static int thisVerCode = 202402210;
31+
public static int thisVerCode = 202402211;
3232
public static boolean isVip = false;
3333
public static boolean isViaVer = true;
3434
public static boolean isEnable = true;

zmusic-plugin/src/main/java/me/zhenxin/zmusic/music/searchSource/BiliBiliMusic.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ public static JsonObject getMusic(String keyword) {
4545
data.addProperty("secret", Config.vipSecret);
4646
data.addProperty("id", "bilibili_" + musicId);
4747
data.addProperty("url", musicUrl);
48-
musicUrl = NetUtils.postNetString("https://api.zhenxin.me/zmusic/vip/m4a2mp3", null, data);
49-
48+
String res = NetUtils.postNetString("https://api.zhenxin.me/zmusic/vip/m4a2mp3", null, data);
49+
JsonObject resJson = gson.fromJson(res, JsonObject.class);
50+
if (resJson.get("code").getAsInt() == 200) {
51+
JsonObject dataJson = resJson.get("data").getAsJsonObject();
52+
String name = dataJson.get("name").getAsString();
53+
musicUrl = "https://api.zhenxin.me/zmusic/vip/download/" + name;
54+
} else {
55+
throw new Exception("M4A转MP3失败");
56+
}
5057
JsonObject returnJSON = new JsonObject();
5158
returnJSON.addProperty("id", musicId);
5259
returnJSON.addProperty("url", musicUrl);

0 commit comments

Comments
 (0)