mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 20:33:03 +00:00
1. add 网易云音乐解析
This commit is contained in:
@@ -75,6 +75,11 @@ public enum PanDomainTemplate {
|
||||
"https://474b\\.com/file/(.+)",
|
||||
"https://474b.com/file/{shareKey}",
|
||||
CtTool.class),
|
||||
// http://163cn.tv/xxx
|
||||
MNE("网易云音乐",
|
||||
"http(s)?://163cn\\.tv/(.+)",
|
||||
"http://163cn.tv/{shareKey}",
|
||||
MneTool.class),
|
||||
// https://pan.huang1111.cn/s/xxx
|
||||
// 通用域名([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}
|
||||
CE("Cloudreve",
|
||||
|
||||
35
parser/src/main/java/cn/qaiu/parser/impl/MneTool.java
Normal file
35
parser/src/main/java/cn/qaiu/parser/impl/MneTool.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package cn.qaiu.parser.impl;
|
||||
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.parser.PanBase;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.uritemplate.UriTemplate;
|
||||
|
||||
/**
|
||||
* 网易云音乐, 单歌曲直链解析
|
||||
* <a href="http://163cn.tv/ykLZJJT">示例分享</a>
|
||||
*/
|
||||
public class MneTool extends PanBase {
|
||||
|
||||
|
||||
public static final String API_URL = "https://music.163.com/song/media/outer/url?id={id}";
|
||||
|
||||
|
||||
public MneTool(ShareLinkInfo shareLinkInfo) {
|
||||
super(shareLinkInfo);
|
||||
}
|
||||
|
||||
public Future<String> parse() {
|
||||
String shareUrl = shareLinkInfo.getStandardUrl();
|
||||
clientNoRedirects.getAbs(shareUrl).send().onSuccess(res -> {
|
||||
String locationURL = res.headers().get("Location");
|
||||
String substring = locationURL.substring(locationURL.indexOf("id="));
|
||||
String id = substring.substring("id=".length(), substring.indexOf('&'));
|
||||
clientNoRedirects.getAbs(UriTemplate.of(API_URL)).setTemplateParam("id", id).send()
|
||||
.onSuccess(res2 -> {
|
||||
promise.complete(res2.headers().get("Location"));
|
||||
}).onFailure(handleFail(API_URL.replace("{id}", id)));
|
||||
}).onFailure(handleFail(shareUrl));
|
||||
return promise.future();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user