diff --git a/pom.xml b/pom.xml
index c22c0cd..601b2ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -377,6 +377,23 @@
springfox-swagger-ui
${swagger.version}
+
+ io.github.openfeign
+ feign-core
+ 10.12
+
+
+
+ org.odpi.egeria
+ http-helper
+ 3.15
+
+
+ org.springframework
+ spring-web
+ 5.3.25
+
+
diff --git a/src/main/java/com/zhangmeng/tools/controller/MusicDownloadController.java b/src/main/java/com/zhangmeng/tools/controller/MusicDownloadController.java
index 33ec292..c0baea8 100644
--- a/src/main/java/com/zhangmeng/tools/controller/MusicDownloadController.java
+++ b/src/main/java/com/zhangmeng/tools/controller/MusicDownloadController.java
@@ -1,6 +1,7 @@
package com.zhangmeng.tools.controller;
import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.io.FileUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
@@ -8,12 +9,18 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Utf8;
import com.zhangmeng.tools.music.SongInfo;
+import com.zhangmeng.tools.music.kugou.KuGouMusic;
+import com.zhangmeng.tools.music.kuwo.DownLoadInfo;
+import com.zhangmeng.tools.music.kuwo.DownLoadURL;
+import com.zhangmeng.tools.music.kuwo.SearchByKey;
import com.zhangmeng.tools.music.qq.QQMusic;
+import com.zhangmeng.tools.music.qq.QqEncrypt;
import com.zhangmeng.tools.music.qq.QqQuery;
import com.zhangmeng.tools.music.wangyiyun.Song;
import com.zhangmeng.tools.music.wangyiyun.WangYiYunMusic;
import com.zhangmeng.tools.utils.AlertUtils;
import javafx.beans.property.SimpleIntegerProperty;
+import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
@@ -22,21 +29,31 @@ import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.sql.Blob;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
+
+import static com.zhangmeng.tools.music.qq.RequestModule.apiServer;
+import static com.zhangmeng.tools.music.qq.RequestModule.headerMap;
/**
* @author : 芊芊墨客
@@ -77,6 +94,15 @@ public class MusicDownloadController {
private SimpleIntegerProperty index = new SimpleIntegerProperty(0);
+ public static final String ku_wo_vip_api = "http://www.kuwo.cn/api/www/search/searchMusicBykeyWord?pn=1&rn=30&httpsStatus=1&reqId=a3d144b0-9570-11ed-9918-83c8c32b357d&key=";
+
+ public static String download_url = "http://www.kuwo.cn/api/v1/www/music/playUrl?type=convert_url3&httpsStatus=1";
+
+ public static SimpleObjectProperty down_load_info = new SimpleObjectProperty<>();
+ public static SimpleObjectProperty data_bean = new SimpleObjectProperty<>();
+
+ public static RestTemplate restTemplate;
+
@FXML
public void initialize() {
wangyiyun_music_init();
@@ -114,8 +140,8 @@ public class MusicDownloadController {
switch (index.get()) {
case 0 -> set(wangyiyun_music_table_view, get_wangyiyun_song_info(title));
case 1 -> set(QQ_music_table_view,get_qq_song_info(title));
-// case 2 -> set(kugou_music_table_view);
-// case 3 -> set(kuwo_music_table_view);
+ case 2 -> set(kugou_music_table_view,get_ku_gou_info(title));
+ case 3 -> set(kuwo_music_table_view,get_kuwo_song_info(title));
// case 4 -> set(migu_music_table_view);
// case 5 -> set(qianqian_music_table_view);
}
@@ -123,9 +149,88 @@ public class MusicDownloadController {
}
+ public ObservableList get_ku_gou_info(String title){
+
+ URL.createObjectURL(new Blob());
+
+ String api = "https://songsearch.kugou.com/song_search_v2";
+ ObservableList list = FXCollections.observableArrayList();
+ HashMap paramMap = new HashMap<>();
+ paramMap.put("keyword", title);
+ paramMap.put("page", 1);
+
+ String result3= HttpUtil.get(api, paramMap);
+ KuGouMusic kuGouMusic = JSON.parseObject(result3, KuGouMusic.class);
+ if (kuGouMusic.getData() != null){
+ List lists = kuGouMusic.getData().getLists();
+ int id = 1;
+ for (KuGouMusic.ResList resList : lists) {
+ SongInfo songInfo = new SongInfo();
+ songInfo.setName( resList.getSongName());
+ songInfo.setArtist(resList.getSingerName());
+ songInfo.setAlbum(resList.getAlbumName());
+ songInfo.setId(id);
+ id ++;
+ list.add(songInfo);
+ }
+ }
+ return list;
+ }
+
+ public ObservableList get_kuwo_song_info(String title){
+ ObservableList list = FXCollections.observableArrayList();
+ List lists = request_api(title);
+ int i = 0 ;
+ for (SongInfo listBean : lists) {
+ i = i + 1 ;
+ listBean.setId(i);
+ list.add(listBean);
+ }
+
+ return list;
+// inputStream = response.getEntity().getContent();
+// byte[] buffer = new byte[1024];
+// int readBytes = 0;
+// StringBuilder stringBuilder = new StringBuilder();
+// while((readBytes = inputStream.read(buffer)) > 0){
+// Thread.sleep(1);
+// stringBuilder.append(new String(buffer, 0, readBytes));
+// }
+ }
+
+ public static List request_api(String key) {
+ String headers_json_path = MusicDownloadController.class.getClassLoader().getResource("headers.json").toExternalForm();
+ try {
+ List list = FileUtil.readLines(new URL(headers_json_path), StandardCharsets.UTF_8);
+ StringBuilder stringBuilder = new StringBuilder();
+ list.forEach(stringBuilder::append);
+ String headers_json = stringBuilder.toString();
+ Map map = JSONObject.parseObject(headers_json, Map.class);
+
+ MultiValueMap headers = new HttpHeaders();
+ for (Map.Entry entry : map.entrySet()) {
+ headers.add(entry.getKey(), entry.getValue());
+ }
+ HttpEntity