mirror of
https://github.com/bizhangjie/CatVodSpider.git
synced 2026-11-04 18:52:12 +00:00
'更新可用状态'
This commit is contained in:
1 parent
fe266300fa
commit
7af399251d
5 files changed
+209
-6
No files matched your search
@@ -11,6 +11,7 @@ import com.github.catvod.R;
|
|||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.spider.CaoLiu;
|
import com.github.catvod.spider.CaoLiu;
|
||||||
import com.github.catvod.spider.Cg51;
|
import com.github.catvod.spider.Cg51;
|
||||||
|
import com.github.catvod.spider.DaGongRen;
|
||||||
import com.github.catvod.spider.Douban;
|
import com.github.catvod.spider.Douban;
|
||||||
import com.github.catvod.spider.Fpie2;
|
import com.github.catvod.spider.Fpie2;
|
||||||
import com.github.catvod.spider.IQIYI;
|
import com.github.catvod.spider.IQIYI;
|
||||||
@@ -66,7 +67,7 @@ public class MainActivity extends Activity {
|
|||||||
private void initSpider() {
|
private void initSpider() {
|
||||||
try {
|
try {
|
||||||
Init.init(getApplicationContext());
|
Init.init(getApplicationContext());
|
||||||
spider = new CaoLiu();
|
spider = new DaGongRen();
|
||||||
spider.init(this, "");
|
spider.init(this, "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -92,7 +93,7 @@ public class MainActivity extends Activity {
|
|||||||
public void categoryContent(){
|
public void categoryContent(){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Logger.t("categoryContent").d(spider.categoryContent("57", "1", true, new HashMap<>()));
|
Logger.t("categoryContent").d(spider.categoryContent("dianshiju", "1", true, new HashMap<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,7 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
public void detailContent() {
|
public void detailContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("cltwqjwpk0000vnaosygqajdn")));
|
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("122554-1-1.html")));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,7 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
public void playerContent() {
|
public void playerContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "454873-5-5.html", new ArrayList<>()));
|
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "122554-1-1.html", new ArrayList<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import com.github.catvod.bean.Class;
|
||||||
|
import com.github.catvod.bean.Result;
|
||||||
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.github.catvod.crawler.Spider;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import com.github.catvod.utils.AESEncryption;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class DaGongRen extends Spider {
|
||||||
|
|
||||||
|
private static final String siteUrl = "https://dagongren1.com";
|
||||||
|
private static final String cateUrl = siteUrl + "/list/";
|
||||||
|
private static final String detailUrl = siteUrl + "/play/";
|
||||||
|
private static final String playUrl = siteUrl + "/play/";
|
||||||
|
private static final String searchUrl = siteUrl + "/search--------------.html?wd=";
|
||||||
|
|
||||||
|
private HashMap<String, String> getHeaders() {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", Util.CHROME);
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) throws Exception {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
List<Class> classes = new ArrayList<>();
|
||||||
|
String[] typeIdList = {"dianying","dianshiju","zongyi","dongman","jilupian","lunlipian"};
|
||||||
|
String[] typeNameList = {"电影","连续剧","综艺","动漫","纪录片","福利"};
|
||||||
|
for (int i = 0; i < typeNameList.length; i++) {
|
||||||
|
classes.add(new Class(typeIdList[i], typeNameList[i]));
|
||||||
|
}
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||||
|
for (Element element : doc.select("a.vodlist_thumb")) {
|
||||||
|
try {
|
||||||
|
String pic = element.attr("data-original");
|
||||||
|
String url = element.attr("href");
|
||||||
|
String name = element.attr("title");
|
||||||
|
if (!pic.startsWith("http")) {
|
||||||
|
pic = siteUrl + pic;
|
||||||
|
}
|
||||||
|
String id = url.split("/")[2];
|
||||||
|
list.add(new Vod(id, name, pic));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.string(classes, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String MD5(String string) {
|
||||||
|
// 创建 MD5 实例
|
||||||
|
try {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
// 计算 MD5 哈希值
|
||||||
|
byte[] hashBytes = md.digest(string.getBytes());
|
||||||
|
|
||||||
|
// 将字节数组转换为十六进制字符串表示
|
||||||
|
StringBuilder hexString = new StringBuilder();
|
||||||
|
for (byte hashByte : hashBytes) {
|
||||||
|
String hex = Integer.toHexString(0xff & hashByte);
|
||||||
|
if (hex.length() == 1) {
|
||||||
|
hexString.append('0');
|
||||||
|
}
|
||||||
|
hexString.append(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 输出加密后的 MD5 字符串
|
||||||
|
System.out.println("MD5 加密: " + hexString.toString());
|
||||||
|
return hexString.toString();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
tid = "/show-" + tid + "--------" + pg + "---.html";
|
||||||
|
String target = siteUrl + tid;
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(target, getHeaders()));
|
||||||
|
for (Element element : doc.select("a.vodlist_thumb")) {
|
||||||
|
try {
|
||||||
|
String pic = element.attr("data-original");
|
||||||
|
String url = element.attr("href");
|
||||||
|
String name = element.attr("title");
|
||||||
|
if (!pic.startsWith("http")) {
|
||||||
|
pic = siteUrl + pic;
|
||||||
|
}
|
||||||
|
String id = url.split("/")[2];
|
||||||
|
list.add(new Vod(id, name, pic));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
||||||
|
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0)), getHeaders()));
|
||||||
|
String name = doc.select("h2.title.margin_0").text();
|
||||||
|
String pic = doc.select("div.play_vlist_thumb").get(0).attr("data-original");
|
||||||
|
// 播放源
|
||||||
|
Elements tabs = doc.select("li.tab-play");
|
||||||
|
Elements list = doc.select("ul.content_playlist");
|
||||||
|
String PlayFrom = "";
|
||||||
|
String PlayUrl = "";
|
||||||
|
for (int i = 0; i < tabs.size(); i++) {
|
||||||
|
String tabName = tabs.get(i).text();
|
||||||
|
if (!"".equals(PlayFrom)) {
|
||||||
|
PlayFrom = PlayFrom + "$$$" + tabName;
|
||||||
|
} else {
|
||||||
|
PlayFrom = PlayFrom + tabName;
|
||||||
|
}
|
||||||
|
Elements li = list.get(i).select("a");
|
||||||
|
String liUrl = "";
|
||||||
|
for (int i1 = 0; i1 < li.size(); i1++) {
|
||||||
|
if (!"".equals(liUrl)) {
|
||||||
|
liUrl = liUrl + "#" + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/play/","");
|
||||||
|
} else {
|
||||||
|
liUrl = liUrl + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/play/","");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!"".equals(PlayUrl)) {
|
||||||
|
PlayUrl = PlayUrl + "$$$" + liUrl;
|
||||||
|
} else {
|
||||||
|
PlayUrl = PlayUrl + liUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(ids.get(0));
|
||||||
|
vod.setVodPic(siteUrl + pic);
|
||||||
|
vod.setVodName(name);
|
||||||
|
vod.setVodPlayFrom(PlayFrom);
|
||||||
|
vod.setVodPlayUrl(PlayUrl);
|
||||||
|
return Result.string(vod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(searchUrl.concat(URLEncoder.encode(key)), getHeaders()));
|
||||||
|
for (Element element : doc.select("div.searchlist_img")) {
|
||||||
|
try {
|
||||||
|
String pic = element.select("a").attr("data-original");
|
||||||
|
String url = element.select("a").attr("href");
|
||||||
|
String name = element.select("a").attr("title");
|
||||||
|
if (!pic.startsWith("http")) {
|
||||||
|
pic = siteUrl + pic;
|
||||||
|
}
|
||||||
|
String id = url.replace("/video/","").replace(".html","-1-1.html");
|
||||||
|
list.add(new Vod(id, name, pic));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.string(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
|
String target = playUrl.concat(id);
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(target));
|
||||||
|
String regex = "\"url\\\":\\\"(.*?)\\\",\\\"url_next\\\":";
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(doc.html());
|
||||||
|
String url = "";
|
||||||
|
if (matcher.find()) {
|
||||||
|
url = URLDecoder.decode(matcher.group(1), "UTF-8").split("&")[0];
|
||||||
|
}
|
||||||
|
return Result.get().url(url).header(getHeaders()).string();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
8c4c4de21d6f31e7c538e54dcd294cc3
|
62a4d9d592a536c5aeb1547cd0cdbb35
|
||||||
+9
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"spider": "https://mirror.ghproxy.com/https://github.com/bizhangjie/CatVodSpider/blob/main/jar/custom_spider.jar;md5;8c4c4de21d6f31e7c538e54dcd294cc3",
|
"spider": "https://mirror.ghproxy.com/https://github.com/bizhangjie/CatVodSpider/blob/main/jar/custom_spider.jar;md5;62a4d9d592a536c5aeb1547cd0cdbb35",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
@@ -58,6 +58,14 @@
|
|||||||
"searchable": 0,
|
"searchable": 0,
|
||||||
"filterable": 1
|
"filterable": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "DaGongRen",
|
||||||
|
"name": "打工人电影 | 影视",
|
||||||
|
"type": 3,
|
||||||
|
"api": "csp_DaGongRen",
|
||||||
|
"searchable": 1,
|
||||||
|
"filterable": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "Jable",
|
"key": "Jable",
|
||||||
"name": "Jable | 科学",
|
"name": "Jable | 科学",
|
||||||
|
|||||||
Reference in new issue
Block a user