admin
2020-08-22 813d2cae75cbae3f216de5f493af643c5a560c82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.yeshi.buwan.util.video;
 
import java.util.Iterator;
import java.util.Set;
 
import com.yeshi.buwan.util.StringUtil;
 
import net.sf.json.JSONObject;
 
public class Le123VideoParser {
 
    public static String getFirstRequestUrl(String url) {
        String st = url.split("www.le123.com/")[1];
        String[] sts = st.split("/");
        return "http://api.le123.com/kuaikan/apisingledetail_json.so?subsrc=" + sts[0] + "&src=" + sts[1] + "&soKey="
                + sts[2];
    }
 
    @SuppressWarnings("unchecked")
    public static String parseFirstResponse(String data) {
        JSONObject object =JSONObject.fromObject(data).optJSONObject("filepath");
        JSONObject urlObj = object.optJSONObject("m3u8");
        if (urlObj == null || !urlObj.toString().contains("http"))
            urlObj = object.optJSONObject("mp4api");
        if (urlObj == null || !urlObj.toString().contains("http"))
            urlObj = object.optJSONObject("mp4");
        if (urlObj != null) {
            Set<String> sets = urlObj.keySet();
            Iterator<String> keys = sets.iterator();
            while (keys.hasNext()) {
                String key = keys.next();
                return urlObj.optString(key);
            }
        }
        return "";
    }
 
    public static String parseSecondResponse(String baseUrl, String data) {
        if (!StringUtil.isNullOrEmpty(baseUrl)) {
            if (baseUrl.contains("iqiyi")) {
                JSONObject obj = JSONObject.fromObject(data.replace("var tvInfoJs={", "{"));
                return obj.optJSONObject("data").optString("m3u");
            }
        }
        return "";
    }
 
}