add - Upyso
This commit is contained in:
@@ -0,0 +1,88 @@
|
|||||||
|
package com.github.catvod.parser;
|
||||||
|
|
||||||
|
import com.github.catvod.utils.Misc;
|
||||||
|
import com.github.catvod.utils.okhttp.OkHttpUtil;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA 2017.2.3.
|
||||||
|
* author: YangQiang
|
||||||
|
* DateTime: 2022/9/5 11:18
|
||||||
|
* updateTime: 2022/9/5 11:18
|
||||||
|
* Description:
|
||||||
|
*/
|
||||||
|
public class Base64Utils {
|
||||||
|
|
||||||
|
public static JSONArray getJSONByUrl(String url){
|
||||||
|
JSONArray a2 = null;
|
||||||
|
try {
|
||||||
|
String json = OkHttpUtil.string(url, Misc.Headers(1,url));
|
||||||
|
String s = getBase64(json),title="",uri="",atime="",zt="";
|
||||||
|
JSONObject jsonObject = new JSONObject(s);
|
||||||
|
if (jsonObject.optString("status", "").equals("success")) {
|
||||||
|
JSONObject o = null, o2 = null;
|
||||||
|
JSONObject jsonObject2 = jsonObject.getJSONObject("result"),oc = null;
|
||||||
|
JSONArray array = jsonObject2.getJSONArray("items"), ac2 = new JSONArray();
|
||||||
|
int z = 11, f=0;
|
||||||
|
int len = array.length() > z ? z : array.length();
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
o2 = new JSONObject();
|
||||||
|
o = (JSONObject) array.get(i);
|
||||||
|
atime = o.optString("available_time", "");
|
||||||
|
if (atime.startsWith("2099")) {
|
||||||
|
title = o.optString("title", "");
|
||||||
|
ac2 = o.getJSONArray("content");
|
||||||
|
f = ac2.length();
|
||||||
|
if (f > 0) {
|
||||||
|
oc = (JSONObject) ac2.get(0);
|
||||||
|
zt = oc.optString("title", "");
|
||||||
|
if (zt.contains("4K")||zt.contains("4k")) {
|
||||||
|
title = title + " 4K";
|
||||||
|
}else if(zt.contains("1080")) title = title + " 1080P";
|
||||||
|
title = title + "/" + f;
|
||||||
|
}
|
||||||
|
|
||||||
|
uri = o.optString("page_url", "");
|
||||||
|
o2.put("title", title);
|
||||||
|
o2.put("url", uri);
|
||||||
|
a2.put(o2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(a2.toString());
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return a2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getBase64(String json){
|
||||||
|
String s = JsonBasic.getBase64(json);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取真实地址
|
||||||
|
//String url = sendGet("https://www.upyunso.com/download.html?url=3DEAD2A1C2069EF6050451BC6D38A3146583A5455F0229464F2B4BDD8934AE28FD535DA70D084ADC8B47CF78DBA2CC76181586F5F3DECAEB37C0B650A3CDDC081397A8787EC99ED49CB9133839352CBAA1730CF7734083878A");
|
||||||
|
public static String sendGet(String url) {
|
||||||
|
String result = "";
|
||||||
|
try {
|
||||||
|
String r = url.replaceAll(".*url=(.*)", "$1");
|
||||||
|
String url1 = "https://api.upyunso.com/download?url=" + r;
|
||||||
|
String s = OkHttpUtil.string(url1, Misc.Headers(1,url));
|
||||||
|
s = getBase64(s);
|
||||||
|
JSONObject jsonObject = new JSONObject(s);
|
||||||
|
if (jsonObject.optString("status", "").equals("success")) {
|
||||||
|
JSONObject jsonObject2 = jsonObject.getJSONObject("result");
|
||||||
|
return jsonObject2.getString("res_url");
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -44,6 +44,11 @@ public class JsonBasic {
|
|||||||
return new JSONObject();
|
return new JSONObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getBase64(String json){
|
||||||
|
json = new String(Base64.decode(json, Base64.DEFAULT | Base64.URL_SAFE | Base64.NO_WRAP));
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
public static HashMap<String, String> getReqHeader(String url) {
|
public static HashMap<String, String> getReqHeader(String url) {
|
||||||
HashMap<String, String> reqHeaders = new HashMap<>();
|
HashMap<String, String> reqHeaders = new HashMap<>();
|
||||||
reqHeaders.put("url", url);
|
reqHeaders.put("url", url);
|
||||||
|
|||||||
@@ -1,108 +0,0 @@
|
|||||||
package com.github.catvod.spider;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import com.github.catvod.crawler.Spider;
|
|
||||||
import com.github.catvod.utils.okhttp.OkHttpUtil;
|
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.jsoup.select.Elements;
|
|
||||||
|
|
||||||
|
|
||||||
public class AliPS extends Spider {
|
|
||||||
private PushAgent pushAgent;
|
|
||||||
private static String b = "https://www.alipansou.com";
|
|
||||||
private static Pattern a = Pattern.compile("(https:\\/\\/www.aliyundrive.com\\/s\\/[^\\\"]+)");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(Context context, String extend) {
|
|
||||||
super.init(context, extend);
|
|
||||||
pushAgent = new PushAgent();
|
|
||||||
pushAgent.init(context, extend);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String detailContent(List<String> list) {
|
|
||||||
try {
|
|
||||||
Pattern pattern = a;
|
|
||||||
if (pattern.matcher(list.get(0)).find()) {
|
|
||||||
return pushAgent.detailContent(list);
|
|
||||||
}
|
|
||||||
Matcher matcher = pattern.matcher(OkHttpUtil.string("https://www.alipansou.com" + list.get(0), null));
|
|
||||||
if (!matcher.find()) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
list.set(0, matcher.group(1).replaceAll("\\\\",""));
|
|
||||||
return pushAgent.detailContent(list);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String playerContent(String str, String str2, List<String> list) {
|
|
||||||
return pushAgent.playerContent(str, str2, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static HashMap<String, String> sHeaders() {
|
|
||||||
HashMap<String, String> headers = new HashMap<>();
|
|
||||||
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36");
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String searchContent(String key, boolean z) {
|
|
||||||
try {
|
|
||||||
HashMap hashMap = new HashMap();
|
|
||||||
hashMap.put("7", "文件夹");
|
|
||||||
hashMap.put("1", "视频");
|
|
||||||
JSONArray jSONArray = new JSONArray();
|
|
||||||
Iterator entries = hashMap.entrySet().iterator();
|
|
||||||
while (entries.hasNext()) {
|
|
||||||
Map.Entry entry = (Map.Entry) entries.next();
|
|
||||||
String str2 = (String) entry.getValue();
|
|
||||||
String sb2 = b + "/search?k=" + URLEncoder.encode(key) + "&t=" + (String) entry.getKey();
|
|
||||||
Document doc = Jsoup.parse(OkHttpUtil.string(sb2, sHeaders()));
|
|
||||||
Elements Data = doc.select("van-row a");
|
|
||||||
for (int i = 0; i < Data.size(); i++) {
|
|
||||||
Element next = Data.get(i);
|
|
||||||
String filename = next.select("template div").text();
|
|
||||||
Pattern pattern = Pattern.compile("(时间: \\S+)");
|
|
||||||
Matcher matcher = pattern.matcher(filename);
|
|
||||||
if (!matcher.find())
|
|
||||||
continue;
|
|
||||||
String remark = matcher.group(1);
|
|
||||||
if (filename.contains(key)) {
|
|
||||||
JSONObject v = new JSONObject();
|
|
||||||
String id = next.attr("href");
|
|
||||||
String title = "[" + str2 + "]" + filename;
|
|
||||||
v.put("vod_id", id);
|
|
||||||
v.put("vod_name", title);
|
|
||||||
v.put("remark", remark);
|
|
||||||
v.put("vod_pic", "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
|
||||||
jSONArray.put(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JSONObject jSONObject2 = new JSONObject();
|
|
||||||
jSONObject2.put("list", jSONArray);
|
|
||||||
return jSONObject2.toString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -216,7 +216,7 @@ public class PushAgent extends Spider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void refreshTk() {
|
private static void refreshTk() {
|
||||||
long b = Time();
|
long b = Time();
|
||||||
String str = j;
|
String str = j;
|
||||||
if (str.isEmpty() || StopRefresh - b <= 600) {
|
if (str.isEmpty() || StopRefresh - b <= 600) {
|
||||||
@@ -808,6 +808,10 @@ public class PushAgent extends Spider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||||
|
return player(flag, id, vipFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String player(String flag, String id, List<String> vipFlags) {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
try {
|
try {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.parser.Base64Utils;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class Upyunso extends Spider {
|
||||||
|
private static String b = "https://www.upyunso.com/";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Context context, String extend) {
|
||||||
|
super.init(context, extend);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> list) {
|
||||||
|
try {
|
||||||
|
String id = list.get(0);
|
||||||
|
String[] idInfo = id.split("\\$\\$\\$");
|
||||||
|
String url = idInfo[0];
|
||||||
|
String pic = idInfo[1];
|
||||||
|
String title = idInfo[2];
|
||||||
|
url = Base64Utils.sendGet(url);
|
||||||
|
list.set(0, url + "$$$" + pic + "$$$" + title);
|
||||||
|
return PushAgent.getDetail(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String str, String str2, List<String> list) {
|
||||||
|
return PushAgent.player(str, str2, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean z) {
|
||||||
|
try {
|
||||||
|
JSONArray jSONArray = new JSONArray();
|
||||||
|
key = URLEncoder.encode(key);
|
||||||
|
JSONArray arr = Base64Utils.getJSONByUrl("https://api.upyunso.com/search?keyword=" + key);
|
||||||
|
String pic = "http://image.xinjun58.com/image/tv/ups.jpg";
|
||||||
|
for (int i = 0; i < arr.length(); i++) {
|
||||||
|
JSONObject v = arr.getJSONObject(i);
|
||||||
|
String id = v.getString("url");
|
||||||
|
String title = v.getString("title");
|
||||||
|
v.put("vod_id", id + "$$$" + pic + "$$$" + title);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
v.put("remark", "");
|
||||||
|
v.put("vod_pic", pic);
|
||||||
|
jSONArray.put(v);
|
||||||
|
}
|
||||||
|
JSONObject jSONObject2 = new JSONObject();
|
||||||
|
jSONObject2.put("list", jSONArray);
|
||||||
|
return jSONObject2.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user