Jelajahi Sumber

搜索视频时,优先返回mp4或标清格式的

yaobo 7 tahun lalu
induk
melakukan
78cf303c33

+ 10 - 0
src/main/java/cn/efunbox/audio/controller/AudioController.java

@@ -232,7 +232,17 @@ public class AudioController {
                         JSONArray array = JSONArray.parseArray(map.get("videos").toString());
                         map = JSONObject.parseObject(array.get(0).toString());
                         String path = map.get("fullPath").toString();
+                        String format = map.get("format").toString();
                         path = path.replaceAll("\n","");
+                        if(array.size()>1 && false==format.equalsIgnoreCase("mp4")){
+                            map = JSONObject.parseObject(array.get(1).toString());
+                            String quality = map.get("quality").toString();
+                            format = map.get("format").toString();
+                            if(quality.equalsIgnoreCase("standard") || format.equalsIgnoreCase("mp4")){
+                                path = map.get("fullPath").toString();
+                                path = path.replaceAll("\n","");
+                            }
+                        }
                         audio.setUrl(path);
                     }