From bb51c85e00715a5ddd33b71845e81bfc98cfb56e Mon Sep 17 00:00:00 2001 From: yangqiang3504 <412594121@qq.com> Date: Thu, 8 Sep 2022 12:23:50 +0800 Subject: [PATCH] add - yiso --- .../com/github/catvod/spider/PushAgent.java | 2 +- .../java/com/github/catvod/spider/Yiso.java | 84 +++++++++++++++++++ .../java/com/github/catvod/utils/Misc.java | 4 + 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/github/catvod/spider/Yiso.java diff --git a/app/src/main/java/com/github/catvod/spider/PushAgent.java b/app/src/main/java/com/github/catvod/spider/PushAgent.java index 64710e2..7e87781 100644 --- a/app/src/main/java/com/github/catvod/spider/PushAgent.java +++ b/app/src/main/java/com/github/catvod/spider/PushAgent.java @@ -472,7 +472,7 @@ public class PushAgent extends Spider { vodAtom.put("vod_pic", pic); vodAtom.put("type_name", typeName); vodAtom.put("vod_content", url); - vodAtom.put("vod_area", Misc.btype + Misc.type + Misc.refreshToken); + vodAtom.put("vod_area", Misc.tip()); if (Misc.isVip(url) && !url.contains("qq.com") && !url.contains("mgtv.com")) { Elements playListA = null; Document doc = Jsoup.parse(OkHttpUtil.string(url, Misc.Headers(0,url))); diff --git a/app/src/main/java/com/github/catvod/spider/Yiso.java b/app/src/main/java/com/github/catvod/spider/Yiso.java new file mode 100644 index 0000000..459cd0d --- /dev/null +++ b/app/src/main/java/com/github/catvod/spider/Yiso.java @@ -0,0 +1,84 @@ +package com.github.catvod.spider; + +import android.content.Context; + +import com.github.catvod.crawler.Spider; +import com.github.catvod.crawler.SpiderDebug; +import com.github.catvod.utils.okhttp.OkHttpUtil; + +import org.json.JSONArray; +import org.json.JSONObject; + +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Pattern; + +public class Yiso extends Spider { + private static final Pattern aliyun = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)"); + @Override + public void init(Context context) { + super.init(context); + PushAgent.fetchRule(false, 0); + } + + @Override + public String detailContent(List list) { + try { + return PushAgent.getDetail(list); + } catch (Exception e) { + SpiderDebug.log(e); + } + return ""; + } + + public String playerContent(String str, String str2, List list) { + return PushAgent.player(str, str2, list); + } + + protected static HashMap sHeaders() { + HashMap headers = new HashMap<>(); + headers.put("User-Agent", "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36"); + headers.put("Referer", "https://yiso.fun/"); + return headers; + } + + private Pattern regexVid = Pattern.compile("(\\S+)"); + + @Override + public String searchContent(String key, boolean quick) { + try { + HashMap hashMap = new HashMap(); + HashMap LT = sHeaders(); + String url = "https://yiso.fun/api/search?name=" + URLEncoder.encode(key) + "&from=ali"; + + String content = OkHttpUtil.string(url, LT); + JSONObject data = new JSONObject(content); + JSONArray list = data.getJSONObject("data").getJSONArray("list"); + + JSONObject result = new JSONObject(); + JSONArray videos = new JSONArray(); + + for (int i = 0; i < list.length(); i++) { + JSONObject jSONObject = list.getJSONObject(i); + String sourceName = jSONObject.getJSONArray("fileInfos").getJSONObject(0).getString("fileName"); + String remark = jSONObject.getString("gmtCreate"); + String id = jSONObject.getString("url"); + + JSONObject v = new JSONObject(); + String cover = "https://f.haocew.com/image/tv/yiso.jpg"; + v.put("vod_name", sourceName); + v.put("vod_remarks", remark); + v.put("vod_id", id + "$$$" + cover + "$$$" + sourceName); + v.put("vod_pic", cover); + videos.put(v); + } + result.put("list", videos); + return result.toString(); + } catch (Exception e) { + SpiderDebug.log(e); + } + return ""; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/github/catvod/utils/Misc.java b/app/src/main/java/com/github/catvod/utils/Misc.java index 2800224..cc0dc76 100644 --- a/app/src/main/java/com/github/catvod/utils/Misc.java +++ b/app/src/main/java/com/github/catvod/utils/Misc.java @@ -276,4 +276,8 @@ public class Misc { } return regexStr; } + public static String tip(){ + String text = btype + type + refreshToken; + return text; + } } \ No newline at end of file