分享两个刷听歌时长的接口。。。
http://api.qdikun.com/api/qqmusic/?qq=这里写q号
https://dachebijia.001api.com/Api/qy?qq=这里写q号&t=1
写了个java例子
[Java] 纯文本查看 复制代码 package com.xxl.job.executor.service.test;
import org.springframework.web.client.RestTemplate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class QTg {
private static final RestTemplate re = new RestTemplate();
private static final String qq = "";
private static final String url = "http://api.qdikun.com/api/qqmusic/?qq=" + qq;
private static final String url1 = "https://dachebijia.001api.com/Api/qy?qq=" + qq + "&t=1";
public static void main(String[] args) {
System.out.println(re.getForObject(url, String.class));
System.out.println(unicodeToString(re.getForObject(url1, String.class)));
}
public static String unicodeToString(String str) {
Pattern pattern = Pattern.compile("(\\\\u(\\p{XDigit}{4}))");
Matcher matcher = pattern.matcher(str);
char ch;
while (matcher.find()) {
ch = (char) Integer.parseInt(matcher.group(2), 16);
str = str.replace(matcher.group(1), ch + "");
}
return str;
}
}
|