ng qxi AppYsV2
This commit is contained in:
parent
d816cb744e
commit
0f0cfb0ad3
|
|
@ -1,23 +1,19 @@
|
||||||
package com.github.catvod.spider;
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -29,7 +25,7 @@ public class AppYsV2 extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) throws Exception {
|
public void init(Context context, String extend) throws Exception {
|
||||||
super.init(context, extend);
|
super.init(context,extend);
|
||||||
try {
|
try {
|
||||||
extInfos = extend.split("###");
|
extInfos = extend.split("###");
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|
@ -365,7 +361,7 @@ public class AppYsV2 extends Spider {
|
||||||
for (int i = 0; i < array.length(); i++) {
|
for (int i = 0; i < array.length(); i++) {
|
||||||
strings.add(array.getString(i));
|
strings.add(array.getString(i));
|
||||||
}
|
}
|
||||||
return TextUtils.join(",", strings);
|
return StringUtils.join(strings, ",");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -554,11 +550,7 @@ public class AppYsV2 extends Spider {
|
||||||
playFlags.add(flag);
|
playFlags.add(flag);
|
||||||
playUrls.add(from.getString("url"));
|
playUrls.add(from.getString("url"));
|
||||||
String purl = from.optString("parse_api").trim();
|
String purl = from.optString("parse_api").trim();
|
||||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
ArrayList<String> parseUrls = parseUrlMap.get(flag)==null?new ArrayList<>():parseUrlMap.get(flag);
|
||||||
if (parseUrls == null) {
|
|
||||||
parseUrls = new ArrayList<>();
|
|
||||||
parseUrlMap.put(flag, parseUrls);
|
|
||||||
}
|
|
||||||
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
||||||
}
|
}
|
||||||
} else if (URL.contains("xgapp")) {
|
} else if (URL.contains("xgapp")) {
|
||||||
|
|
@ -581,11 +573,7 @@ public class AppYsV2 extends Spider {
|
||||||
playFlags.add(flag);
|
playFlags.add(flag);
|
||||||
playUrls.add(from.getString("url"));
|
playUrls.add(from.getString("url"));
|
||||||
String purl = from.optString("parse_api").trim();
|
String purl = from.optString("parse_api").trim();
|
||||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
ArrayList<String> parseUrls = parseUrlMap.get(flag)==null?new ArrayList<>():parseUrlMap.get(flag);
|
||||||
if (parseUrls == null) {
|
|
||||||
parseUrls = new ArrayList<>();
|
|
||||||
parseUrlMap.put(flag, parseUrls);
|
|
||||||
}
|
|
||||||
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
if (!purl.isEmpty() && !parseUrls.contains(purl)) parseUrls.add(purl);
|
||||||
}
|
}
|
||||||
} else if (/*urlPattern2.matcher(URL).find()*/URL.contains(".vod")) {
|
} else if (/*urlPattern2.matcher(URL).find()*/URL.contains(".vod")) {
|
||||||
|
|
@ -613,12 +601,7 @@ public class AppYsV2 extends Spider {
|
||||||
String[] parse2 = from.getJSONObject("player_info").optString("parse2").split(",");
|
String[] parse2 = from.getJSONObject("player_info").optString("parse2").split(",");
|
||||||
parses.addAll(Arrays.asList(parse1));
|
parses.addAll(Arrays.asList(parse1));
|
||||||
parses.addAll(Arrays.asList(parse2));
|
parses.addAll(Arrays.asList(parse2));
|
||||||
ArrayList<String> parseUrls = parseUrlMap.get(flag);
|
ArrayList<String> parseUrls = parseUrlMap.get(flag)==null?new ArrayList<>():parseUrlMap.get(flag); for (String purl : parses) {
|
||||||
if (parseUrls == null) {
|
|
||||||
parseUrls = new ArrayList<>();
|
|
||||||
parseUrlMap.put(flag, parseUrls);
|
|
||||||
}
|
|
||||||
for (String purl : parses) {
|
|
||||||
if (purl.contains("http")) {
|
if (purl.contains("http")) {
|
||||||
Matcher matcher = parsePattern1.matcher(purl);
|
Matcher matcher = parsePattern1.matcher(purl);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
|
@ -681,11 +664,11 @@ public class AppYsV2 extends Spider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playFlags.add(flag);
|
playFlags.add(flag);
|
||||||
playUrls.add(TextUtils.join("#", urls));
|
playUrls.add(StringUtils.join(urls, "#"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vod.put("vod_play_from", TextUtils.join("$$$", playFlags));
|
vod.put("vod_play_from", StringUtils.join(playFlags, "$$$"));
|
||||||
vod.put("vod_play_url", TextUtils.join("$$$", playUrls));
|
vod.put("vod_play_url", StringUtils.join(playUrls, "$$$"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ######视频地址
|
// ######视频地址
|
||||||
|
|
@ -782,7 +765,7 @@ public class AppYsV2 extends Spider {
|
||||||
} else if (jsonPlayData.has("User-Agent")) {
|
} else if (jsonPlayData.has("User-Agent")) {
|
||||||
ua = jsonPlayData.optString("User-Agent", "");
|
ua = jsonPlayData.optString("User-Agent", "");
|
||||||
}
|
}
|
||||||
if (ua.trim().length() > 0) {
|
if (!ua.trim().isEmpty()) {
|
||||||
headers.put("User-Agent", " " + ua);
|
headers.put("User-Agent", " " + ua);
|
||||||
}
|
}
|
||||||
String referer = "";
|
String referer = "";
|
||||||
|
|
@ -791,7 +774,7 @@ public class AppYsV2 extends Spider {
|
||||||
} else if (jsonPlayData.has("Referer")) {
|
} else if (jsonPlayData.has("Referer")) {
|
||||||
referer = jsonPlayData.optString("Referer", "");
|
referer = jsonPlayData.optString("Referer", "");
|
||||||
}
|
}
|
||||||
if (referer.trim().length() > 0) {
|
if (!referer.trim().isEmpty()) {
|
||||||
headers.put("Referer", " " + referer);
|
headers.put("Referer", " " + referer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,437 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Class;
|
||||||
|
import com.github.catvod.bean.Filter;
|
||||||
|
import com.github.catvod.bean.Result;
|
||||||
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import com.github.catvod.utils.Json;
|
||||||
|
import com.github.catvod.utils.ProxyVideo;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class NG extends Spider {
|
||||||
|
private final String FIND_VIDEO_VOD_LIST = "/api.php/provide/vod_list";
|
||||||
|
private final String FIND_CLASSIFICATION = "/api.php/provide/home_nav";
|
||||||
|
private final String VIDEO_DETAIL = "/api.php/provide/vod_detail";
|
||||||
|
private final String SEARCH_SEARCH = "/api.php/provide/search_result";
|
||||||
|
private final List<Class> classList = new ArrayList<>();
|
||||||
|
private final LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
|
||||||
|
private final String COMMON_URL = Util.base64Decode("aHR0cDovL3lzLmNoYW5nbWVuZ3l1bi5jb20=");
|
||||||
|
|
||||||
|
private Map<String, String> getParams() {
|
||||||
|
Map<String, String> hashMap = new HashMap<>();
|
||||||
|
hashMap.put("devices", "android");
|
||||||
|
hashMap.put("deviceModel", "ASUS_I003DD");
|
||||||
|
hashMap.put("deviceBrand", "ASUS");
|
||||||
|
hashMap.put("deviceVersion", "9");
|
||||||
|
hashMap.put("deviceScreen", "2340*1080");
|
||||||
|
hashMap.put("appVersionCode", "9");
|
||||||
|
hashMap.put("appVersionName", "1.0.9");
|
||||||
|
hashMap.put("time", String.valueOf(System.currentTimeMillis() / 1000));
|
||||||
|
hashMap.put("imei", "");
|
||||||
|
hashMap.put("app", "ylys");
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getHeaders() {
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
headers.put("timeMillis", String.valueOf(currentTimeMillis));
|
||||||
|
headers.put("sign", Util.MD5(Util.base64Decode("I3VCRnN6ZEVNMG9MMEpSbkA=") + currentTimeMillis));
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) {
|
||||||
|
if (classList.isEmpty()) {
|
||||||
|
String string = OkHttp.string(COMMON_URL + FIND_CLASSIFICATION, getParams(), getHeaders());
|
||||||
|
|
||||||
|
JsonArray filterList = JsonParser.parseString(string).getAsJsonArray();
|
||||||
|
for (int index = 0; index < filterList.size(); index++) {
|
||||||
|
if (index == 0) continue;
|
||||||
|
JsonObject obj = filterList.get(index).getAsJsonObject();
|
||||||
|
int id = obj.get("id").getAsInt();
|
||||||
|
String name = obj.get("name").getAsString();
|
||||||
|
Class clazz = new Class(String.valueOf(id), name);
|
||||||
|
classList.add(clazz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.string(classList, filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
|
try {
|
||||||
|
Map<String, String> params = new HashMap<>(getParams());
|
||||||
|
for (String s : extend.keySet()) {
|
||||||
|
params.put(s, URLEncoder.encode(extend.get(s), "UTF-8"));
|
||||||
|
}
|
||||||
|
params.put("page", pg);
|
||||||
|
params.put("id", tid);
|
||||||
|
String string = OkHttp.string(COMMON_URL + FIND_VIDEO_VOD_LIST, params, getHeaders());
|
||||||
|
Type type = new TypeToken<Rst<It>>() {
|
||||||
|
}.getType();
|
||||||
|
Rst<It> resp = Json.parseSafe(string, type);
|
||||||
|
List<Vod> vodList = new ArrayList<>();
|
||||||
|
if (resp != null && resp.isSuccess()) {
|
||||||
|
for (It it : resp.getList()) {
|
||||||
|
vodList.add(it.toVod());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SpiderDebug.log("ng cate error: " + string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.string(classList, vodList, filters);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) {
|
||||||
|
Map<String, String> map = new HashMap<>(getParams());
|
||||||
|
map.put("id", ids.get(0));
|
||||||
|
String string = OkHttp.string(COMMON_URL + VIDEO_DETAIL, map, getHeaders());
|
||||||
|
Type type = new TypeToken<Rst<Dt>>() {
|
||||||
|
}.getType();
|
||||||
|
Rst<Dt> dt = Json.parseSafe(string, type);
|
||||||
|
if (!dt.isSuccess()) {
|
||||||
|
SpiderDebug.log("ng detail err: " + dt.getMsg());
|
||||||
|
return Result.error(dt.getMsg());
|
||||||
|
}
|
||||||
|
return Result.string(dt.data.toVod());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||||
|
String string = OkHttp.string(id);
|
||||||
|
Type type = new TypeToken<Rst<PlayRst>>() {
|
||||||
|
}.getType();
|
||||||
|
Rst<PlayRst> rst = Json.parseSafe(string, type);
|
||||||
|
if (!rst.isSuccess()) {
|
||||||
|
SpiderDebug.log("play err: " + rst.getMsg());
|
||||||
|
return Result.error(rst.getMsg());
|
||||||
|
}
|
||||||
|
Map<String, String> filter = new HashMap<>();
|
||||||
|
|
||||||
|
for (String s : rst.getData().getHeader().keySet()) {
|
||||||
|
if (s.equals("User-Agent")) {
|
||||||
|
filter.put(s, rst.getData().getHeader().get(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.get().url(ProxyVideo.buildCommonProxyUrl(rst.getData().getUrl(), filter)).string();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) throws UnsupportedEncodingException {
|
||||||
|
Map<String, String> params = new HashMap<>(getParams());
|
||||||
|
params.put("video_name", URLEncoder.encode(key,"UTF-8"));
|
||||||
|
String string = OkHttp.string(COMMON_URL + SEARCH_SEARCH, params, getHeaders());
|
||||||
|
Type type = new TypeToken<Rst<List<SearchRst>>>() {
|
||||||
|
}.getType();
|
||||||
|
Rst<List<SearchRst>> rst = Json.parseSafe(string, type);
|
||||||
|
if (!rst.isSuccess()) {
|
||||||
|
SpiderDebug.log("ng search error: " + rst.getMsg());
|
||||||
|
return Result.error(rst.getMsg());
|
||||||
|
}
|
||||||
|
return Result.string(rst.getData().get(0).toVodList());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Rst<T> {
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
private String limit;
|
||||||
|
private int pagecount;
|
||||||
|
private int total;
|
||||||
|
private List<T> list;
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return code == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(String limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPagecount() {
|
||||||
|
return pagecount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagecount(int pagecount) {
|
||||||
|
this.pagecount = pagecount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(int total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<T> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class It {
|
||||||
|
private int id;
|
||||||
|
private String img;
|
||||||
|
private String name;
|
||||||
|
private String score;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public Vod toVod() {
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(String.valueOf(id));
|
||||||
|
vod.setVodName(name);
|
||||||
|
vod.setVodRemarks(score);
|
||||||
|
vod.setVodPic(img);
|
||||||
|
return vod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Dt {
|
||||||
|
private String name;
|
||||||
|
private String year;
|
||||||
|
private String score;
|
||||||
|
private int hits;
|
||||||
|
private String type;
|
||||||
|
private String img;
|
||||||
|
private String info;
|
||||||
|
@SerializedName("total_count")
|
||||||
|
private int totalCount;
|
||||||
|
@SerializedName("player_info")
|
||||||
|
private List<DtIt> playerInfo;
|
||||||
|
|
||||||
|
public Vod toVod() {
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(name + score);
|
||||||
|
vod.setVodName(name);
|
||||||
|
vod.setVodPic(img);
|
||||||
|
vod.setVodTag(type);
|
||||||
|
vod.setVodRemarks(year);
|
||||||
|
vod.setVodContent(info);
|
||||||
|
|
||||||
|
StringBuilder playFrom = new StringBuilder();
|
||||||
|
StringBuilder playUrl = new StringBuilder();
|
||||||
|
|
||||||
|
for (DtIt info : playerInfo) {
|
||||||
|
playFrom.append(info.getShow()).append("$$$");
|
||||||
|
for (VtInfo vtInfo : info.getVideoInfo()) {
|
||||||
|
|
||||||
|
playUrl.append(vtInfo.getName()).append("$").append(vtInfo.getUrl().get(0));
|
||||||
|
playUrl.append("#");
|
||||||
|
|
||||||
|
}
|
||||||
|
playUrl.append("$$$");
|
||||||
|
}
|
||||||
|
|
||||||
|
vod.setVodPlayFrom(playFrom.toString());
|
||||||
|
vod.setVodPlayUrl(playUrl.toString());
|
||||||
|
return vod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DtIt {
|
||||||
|
private int id;
|
||||||
|
private String from;
|
||||||
|
private String show;
|
||||||
|
@SerializedName("url_count")
|
||||||
|
private int urlCount;
|
||||||
|
@SerializedName("video_info")
|
||||||
|
private List<VtInfo> videoInfo;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrom(String from) {
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShow() {
|
||||||
|
return show;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShow(String show) {
|
||||||
|
this.show = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUrlCount() {
|
||||||
|
return urlCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrlCount(int urlCount) {
|
||||||
|
this.urlCount = urlCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VtInfo> getVideoInfo() {
|
||||||
|
return videoInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoInfo(List<VtInfo> videoInfo) {
|
||||||
|
this.videoInfo = videoInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class VtInfo {
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private String pic;
|
||||||
|
private List<String> url;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPic() {
|
||||||
|
return pic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPic(String pic) {
|
||||||
|
this.pic = pic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(List<String> url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PlayRst {
|
||||||
|
private String url;
|
||||||
|
private Map<String, String> header;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getHeader() {
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeader(Map<String, String> header) {
|
||||||
|
this.header = header;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SearchRst {
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private List<SearchRstItem> data;
|
||||||
|
|
||||||
|
public List<Vod> toVodList() {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (SearchRstItem datum : data) {
|
||||||
|
list.add(datum.toVOd());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SearchRstItem {
|
||||||
|
private int id;
|
||||||
|
private int type;
|
||||||
|
@SerializedName("video_name")
|
||||||
|
private String videoName;
|
||||||
|
private String qingxidu;
|
||||||
|
private String img;
|
||||||
|
private String director;
|
||||||
|
@SerializedName("main_actor")
|
||||||
|
private String mainActor;
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
public Vod toVOd() {
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(String.valueOf(id));
|
||||||
|
vod.setVodTag(qingxidu);
|
||||||
|
vod.setVodPic(img);
|
||||||
|
vod.setVodRemarks(category);
|
||||||
|
vod.setVodName(videoName);
|
||||||
|
vod.setVodActor(mainActor);
|
||||||
|
return vod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,14 +6,7 @@ import com.github.catvod.bean.Vod;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
@ -25,16 +18,16 @@ import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Objects;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class QxiTv extends Spider {
|
public class QxiTv extends Spider {
|
||||||
|
|
||||||
private static final String siteUrl = "https://www.7xi.tv";
|
private static final String siteUrl = "https://www.7xi.tv";
|
||||||
private static final String cateUrl = siteUrl + "/index.php/api/vod";
|
private static final String cateUrl = siteUrl + "/vodtype/";
|
||||||
private static final String detailUrl = siteUrl + "/voddetail/";
|
|
||||||
private static final String searchUrl = siteUrl + "/vodsearch/page/1/wd/";
|
private static final String searchUrl = siteUrl + "/vodsearch/page/1/wd/";
|
||||||
|
private static final String playUrl = siteUrl + "/FosiPlayer/API.php";
|
||||||
|
|
||||||
private HashMap<String, String> getHeaders() {
|
private HashMap<String, String> getHeaders() {
|
||||||
HashMap<String, String> headers = new HashMap<>();
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
|
@ -46,16 +39,15 @@ public class QxiTv extends Spider {
|
||||||
public String homeContent(boolean filter) throws Exception {
|
public String homeContent(boolean filter) throws Exception {
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
List<Class> classes = new ArrayList<>();
|
List<Class> classes = new ArrayList<>();
|
||||||
|
|
||||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||||
int index = 1;
|
for (Element element : doc.select("ul.swiper-wrapper > li.swiper-slide > a")) {
|
||||||
for (Element element : doc.select("h4.title-h")) {
|
if(element.text().contains("留言")){
|
||||||
String typeId = element.select("a").attr("href");
|
break;
|
||||||
String typeName = element.select("span").text();
|
|
||||||
if (!"".equals(typeName) && index != 1 && index != 6) {
|
|
||||||
classes.add(new Class(typeId, typeName.replace(" 查看更多","")));
|
|
||||||
}
|
}
|
||||||
index++;
|
classes.add(new Class(element.attr("href"),element.text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Element element : doc.select("a.public-list-exp")) {
|
for (Element element : doc.select("a.public-list-exp")) {
|
||||||
try {
|
try {
|
||||||
String pic = element.select("img").attr("data-src");
|
String pic = element.select("img").attr("data-src");
|
||||||
|
|
@ -64,9 +56,8 @@ public class QxiTv extends Spider {
|
||||||
if (!pic.startsWith("http")) {
|
if (!pic.startsWith("http")) {
|
||||||
pic = siteUrl + pic;
|
pic = siteUrl + pic;
|
||||||
}
|
}
|
||||||
String id = url.split("/")[2];
|
list.add(new Vod(url, name, pic));
|
||||||
list.add(new Vod(id, name, pic));
|
} catch (Exception ignored) {
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,35 +93,29 @@ public class QxiTv extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
List<Vod> list = new ArrayList<>();
|
String url = siteUrl + tid;
|
||||||
String target = cateUrl + tid;
|
if(!Objects.equals(pg, "1")){
|
||||||
HashMap<String, String> params = new HashMap<>();
|
url += "-" + pg;
|
||||||
params.put("type", tid.split("/")[2].replace(".html", ""));
|
|
||||||
params.put("page", pg);
|
|
||||||
String time = String.valueOf(System.currentTimeMillis());
|
|
||||||
params.put("time", time);
|
|
||||||
String string = "DS" + time + "DCC147D11943AF75";
|
|
||||||
params.put("key", MD5(string));
|
|
||||||
String data = OkHttp.post(target, params);
|
|
||||||
Gson gson = new Gson();
|
|
||||||
JsonObject jsonObject = gson.fromJson(data, JsonObject.class);
|
|
||||||
JsonArray jsonArray = jsonObject.getAsJsonArray("list");
|
|
||||||
for (JsonElement element : jsonArray) {
|
|
||||||
String id = String.valueOf(element.getAsJsonObject().get("vod_id"));
|
|
||||||
String name = String.valueOf(element.getAsJsonObject().get("vod_name")).replace("\"", "");
|
|
||||||
String pic = String.valueOf(element.getAsJsonObject().get("vod_pic")).replace("\"", "");
|
|
||||||
if (!pic.startsWith("http")) {
|
|
||||||
pic = siteUrl + pic;
|
|
||||||
}
|
|
||||||
list.add(new Vod(id, name, pic));
|
|
||||||
}
|
}
|
||||||
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
String res = OkHttp.string(url, getHeaders());
|
||||||
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list);
|
Document document = Jsoup.parse(res);
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
Elements vodList = document.select("a.public-list-exp");
|
||||||
|
for (Element element : vodList) {
|
||||||
|
String vodId = element.attr("href");
|
||||||
|
String title = element.attr("title");
|
||||||
|
String img = element.select("img").attr("data-src");
|
||||||
|
String remark = element.select(".public-list-prb").val();
|
||||||
|
list.add(new Vod(vodId, title, img, remark));
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer total = Integer.MAX_VALUE;
|
||||||
|
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, list.size(), total, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0)).concat(".html"), getHeaders()));
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl + ids.get(0), getHeaders()));
|
||||||
String name = doc.select("div.this-desc-title").text();
|
String name = doc.select("div.this-desc-title").text();
|
||||||
String pic = doc.select("div.this-pic-bj").attr("style").replace("background-image: url('", "").replace("')", "");
|
String pic = doc.select("div.this-pic-bj").attr("style").replace("background-image: url('", "").replace("')", "");
|
||||||
String year = doc.select("div.this-desc-info > span").get(1).text();
|
String year = doc.select("div.this-desc-info > span").get(1).text();
|
||||||
|
|
@ -185,8 +170,7 @@ public class QxiTv extends Spider {
|
||||||
if (!pic.startsWith("http")) {
|
if (!pic.startsWith("http")) {
|
||||||
pic = siteUrl + pic;
|
pic = siteUrl + pic;
|
||||||
}
|
}
|
||||||
String id = url.split("/")[2];
|
list.add(new Vod(url, name, pic));
|
||||||
list.add(new Vod(id, name, pic));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -205,6 +189,7 @@ public class QxiTv extends Spider {
|
||||||
url = matcher.group(1);
|
url = matcher.group(1);
|
||||||
url = url.replace("\\/","/") + "m3u8";
|
url = url.replace("\\/","/") + "m3u8";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.get().url(url).header(getHeaders()).string();
|
return Result.get().url(url).header(getHeaders()).string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package com.github.catvod.utils;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
public class Json {
|
public class Json {
|
||||||
|
|
||||||
|
|
@ -22,4 +27,14 @@ public class Json {
|
||||||
return new JsonObject();
|
return new JsonObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T parseSafe(String json, Type t) {
|
||||||
|
try {
|
||||||
|
return new Gson().fromJson(json, t);
|
||||||
|
} catch (JsonSyntaxException e) {
|
||||||
|
SpiderDebug.log("json parse error: " + e.getMessage() + "\n" + " " + json);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.util.Base64;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
|
|
@ -17,6 +18,7 @@ import org.mozilla.universalchardet.UniversalDetector;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -25,11 +27,6 @@ import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import okhttp3.Cookie;
|
|
||||||
import okhttp3.Headers;
|
|
||||||
import okhttp3.internal.http.HttpHeaders;
|
|
||||||
import okhttp3.internal.http2.Header;
|
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
||||||
|
|
@ -273,4 +270,8 @@ public class Util {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String base64Decode(String s) {
|
||||||
|
return new String(android.util.Base64.decode(s, Base64.DEFAULT), Charset.defaultCharset());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -55,7 +55,7 @@ public class QxiTvTest {
|
||||||
|
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
public void categoryContent() throws Exception {
|
public void categoryContent() throws Exception {
|
||||||
String content = spider.categoryContent("1", "2", true, null);
|
String content = spider.categoryContent("/vodtype/2/", "2", true, null);
|
||||||
JsonObject map = Json.safeObject(content);
|
JsonObject map = Json.safeObject(content);
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
System.out.println("categoryContent--" + gson.toJson(map));
|
System.out.println("categoryContent--" + gson.toJson(map));
|
||||||
|
|
@ -65,7 +65,7 @@ public class QxiTvTest {
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
public void detailContent() throws Exception {
|
public void detailContent() throws Exception {
|
||||||
|
|
||||||
String content = spider.detailContent(Arrays.asList("index126780.html"));
|
String content = spider.detailContent(Arrays.asList("/voddetail/867573/"));
|
||||||
JsonObject map = Json.safeObject(content);
|
JsonObject map = Json.safeObject(content);
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
System.out.println("detailContent--" + gson.toJson(map));
|
System.out.println("detailContent--" + gson.toJson(map));
|
||||||
|
|
@ -74,7 +74,7 @@ public class QxiTvTest {
|
||||||
|
|
||||||
@org.junit.Test
|
@org.junit.Test
|
||||||
public void playerContent() throws Exception {
|
public void playerContent() throws Exception {
|
||||||
String content = spider.playerContent("", "126780-0-0.html", new ArrayList<>());
|
String content = spider.playerContent("甄选蓝光6", "/vodplay/867573-1-1/", new ArrayList<>());
|
||||||
JsonObject map = Json.safeObject(content);
|
JsonObject map = Json.safeObject(content);
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
System.out.println("playerContent--" + gson.toJson(map));
|
System.out.println("playerContent--" + gson.toJson(map));
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
4e701cc52253ca010c293c86c2d6d3e6
|
03e3184db97fde66e469c8b92b9c4a97
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;4e701cc52253ca010c293c86c2d6d3e6",
|
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;03e3184db97fde66e469c8b92b9c4a97",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
@ -110,6 +110,14 @@
|
||||||
"searchable": 0,
|
"searchable": 0,
|
||||||
"filterable": 1
|
"filterable": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "甲子",
|
||||||
|
"name": "甲子",
|
||||||
|
"type": 3,
|
||||||
|
"api": "csp_AppYsV2",
|
||||||
|
"searchable": 1,
|
||||||
|
"ext": "http://211.101.237.197:6532/api.php/app/"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "JustLive",
|
"key": "JustLive",
|
||||||
"name": "\uD83D\uDCFA\uFE0F JustLive | 直播",
|
"name": "\uD83D\uDCFA\uFE0F JustLive | 直播",
|
||||||
|
|
@ -162,11 +170,12 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "QxiTv",
|
"key": "QxiTv",
|
||||||
"name": "\uD83E\uDD70 7喜 | 影视(不稳定)",
|
"name": "七喜 | 影视",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"api": "csp_QxiTv",
|
"api": "csp_QxiTv",
|
||||||
"searchable": 1,
|
"searchable": 1,
|
||||||
"filterable": 1
|
"changeable": 0,
|
||||||
|
"ext": {}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parses": [
|
"parses": [
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;4e701cc52253ca010c293c86c2d6d3e6",
|
"spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;03e3184db97fde66e469c8b92b9c4a97",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue