Add files via upload
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttpUtil;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author ColaMint & FongMi
|
||||
*/
|
||||
public class PanSou extends Spider {
|
||||
|
||||
private final Pattern regexAliUrl = Pattern.compile("(https:\\/\\/www.aliyundrive.com\\/s\\/[^\\\"]+)");
|
||||
private final String siteUrl = "https://www.alipansou.com";
|
||||
private Ali ali;
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
ali = new Ali(extend);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String url = ids.get(0);
|
||||
Matcher matcher = regexAliUrl.matcher(url);
|
||||
if (matcher.find()) return ali.detailContent(ids);
|
||||
url = siteUrl + ids.get(0);
|
||||
String html = OkHttpUtil.string(url);
|
||||
matcher = regexAliUrl.matcher(html);
|
||||
if (!matcher.find()) return "";
|
||||
ids.set(0, matcher.group(1).replace("\\/", "/"));
|
||||
return ali.detailContent(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) {
|
||||
Map<String, String> types = new HashMap<>();
|
||||
types.put("7", "資料夾");
|
||||
types.put("1", "影片");
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : types.entrySet()) {
|
||||
String typeId = entry.getKey();
|
||||
String typeName = entry.getValue();
|
||||
String url = siteUrl + "/search?k=" + URLEncoder.encode(key) + "&t=" + typeId;
|
||||
Elements items = Jsoup.parse(OkHttpUtil.string(url)).select("van-row > a");
|
||||
for (Element item : items) {
|
||||
String title = item.selectFirst("template").text().trim();
|
||||
if (!title.contains(key)) continue;
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(item.attr("href"));
|
||||
vod.setVodName("[" + typeName + "] " + title);
|
||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
||||
list.add(vod);
|
||||
}
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
return ali.playerContent(flag, id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
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.bean.paper.Data;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttpUtil;
|
||||
import com.github.catvod.utils.Misc;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ColaMint & FongMi
|
||||
*/
|
||||
public class Paper extends Spider {
|
||||
|
||||
private final String URL = "https://gitcafe.net/alipaper/";
|
||||
private List<String> types;
|
||||
private Ali ali;
|
||||
|
||||
private HashMap<String, String> getHeaders() {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", Misc.CHROME);
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
types = Arrays.asList("hyds", "rhds", "omds", "qtds", "hydy", "rhdy", "omdy", "qtdy", "hydm", "rhdm", "omdm", "jlp", "zyp", "jypx", "qtsp");
|
||||
ali = new Ali(extend);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) {
|
||||
Document doc = Jsoup.parse(OkHttpUtil.string(URL, getHeaders()));
|
||||
Elements trs = doc.select("table.tableizer-table > tbody > tr");
|
||||
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
|
||||
List<Class> classes = new ArrayList<>();
|
||||
for (Element tr : trs) {
|
||||
List<Filter.Value> values = new ArrayList<>();
|
||||
for (Element td : tr.select("td")) {
|
||||
if (td.hasClass("tableizer-title")) {
|
||||
String typeId = td.select("a").attr("href").replace("#", "");
|
||||
if (!types.contains(typeId)) continue;
|
||||
classes.add(new Class(typeId, td.text()));
|
||||
filters.put(typeId, Arrays.asList(new Filter("type", "類型", values)));
|
||||
} else {
|
||||
String value = td.select("a").attr("onclick").split("'")[1];
|
||||
values.add(new Filter.Value(td.text(), value));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.string(classes, filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeVideoContent() throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONObject homeData = new JSONObject(OkHttpUtil.string(URL + "home.json", getHeaders()));
|
||||
List<Data> items = Data.arrayFrom(homeData.getJSONObject("info").getJSONArray("new").toString());
|
||||
for (Data item : items) if (types.contains(item.getCat())) list.add(item.getVod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
String type = extend.containsKey("type") ? extend.get("type") : tid;
|
||||
List<Data> items = Data.arrayFrom(OkHttpUtil.string(URL + "data/" + type + ".json", getHeaders()));
|
||||
for (Data item : items) list.add(item.getVod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
return ali.detailContent(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("action", "search");
|
||||
params.put("keyword", key);
|
||||
String result = OkHttpUtil.post("https://gitcafe.net/tool/alipaper/", params, getHeaders());
|
||||
for (Data item : Data.arrayFrom(result)) if (types.contains(item.getCat()) && item.getTitle().contains(key)) list.add(item.getVod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return ali.playerContent(flag, id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.github.catvod.bean.Result;
|
||||
import com.github.catvod.bean.Vod;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.utils.Misc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Push extends Spider {
|
||||
|
||||
private Ali ali;
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
ali = new Ali(extend);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
String url = ids.get(0).trim();
|
||||
if (url.contains("aliyundrive")) return ali.detailContent(ids);
|
||||
if (Misc.isVip(url)) return Result.string(vod(url, "官源"));
|
||||
else if (Misc.isVideoFormat(url)) return Result.string(vod(url, "直連"));
|
||||
else if (url.startsWith("magnet")) return Result.string(vod(url, "磁力"));
|
||||
else if (url.startsWith("http")) return Result.string(vod(url, "網頁"));
|
||||
else return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
if (flag.contains("畫")) return ali.playerContent(flag, id);
|
||||
if (flag.equals("官源")) return Result.get().parse().jx().url(id).string();
|
||||
if (flag.equals("直連")) return Result.get().url(id).string();
|
||||
return Result.get().parse().url(id).string();
|
||||
}
|
||||
|
||||
private Vod vod(String url, String type) {
|
||||
Vod vod = new Vod();
|
||||
vod.setTypeName(type);
|
||||
vod.setVodId(url);
|
||||
vod.setVodName(url);
|
||||
vod.setVodPlayFrom(type);
|
||||
vod.setVodPlayUrl("播放$" + url);
|
||||
vod.setVodPic("https://pic.rmb.bdstatic.com/bjh/1d0b02d0f57f0a42201f92caba5107ed.jpeg");
|
||||
return vod;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user