mirror of
https://github.com/bizhangjie/CatVodSpider.git
synced 2026-11-04 18:52:12 +00:00
'更新可用状态'
This commit is contained in:
1 parent
26eb5b4d9d
commit
017033002f
5 files changed
+158
-41
No files matched your search
@@ -2,7 +2,9 @@ package com.github.catvod.debug;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.github.catvod.R;
|
import com.github.catvod.R;
|
||||||
@@ -12,6 +14,8 @@ import com.github.catvod.spider.Douban;
|
|||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.spider.J91;
|
import com.github.catvod.spider.J91;
|
||||||
import com.github.catvod.spider.Jable;
|
import com.github.catvod.spider.Jable;
|
||||||
|
import com.github.catvod.spider.JavDb;
|
||||||
|
import com.github.catvod.spider.JustLive;
|
||||||
import com.github.catvod.spider.QxiTv;
|
import com.github.catvod.spider.QxiTv;
|
||||||
import com.github.catvod.spider.Wogg;
|
import com.github.catvod.spider.Wogg;
|
||||||
import com.github.catvod.spider.Zhaozy;
|
import com.github.catvod.spider.Zhaozy;
|
||||||
@@ -29,7 +33,6 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
private ExecutorService executor;
|
private ExecutorService executor;
|
||||||
private Spider spider;
|
private Spider spider;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -54,7 +57,7 @@ public class MainActivity extends Activity {
|
|||||||
private void initSpider() {
|
private void initSpider() {
|
||||||
try {
|
try {
|
||||||
Init.init(getApplicationContext());
|
Init.init(getApplicationContext());
|
||||||
spider = new Cg51();
|
spider = new QxiTv();
|
||||||
spider.init(this, "");
|
spider.init(this, "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -79,7 +82,7 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
public void categoryContent() {
|
public void categoryContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("categoryContent").d(spider.categoryContent("wpcz", "6", true, new HashMap<>()));
|
Logger.t("categoryContent").d(spider.categoryContent("/vodtype/1.html", "1", true, new HashMap<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -87,7 +90,7 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
public void detailContent() {
|
public void detailContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("123488")));
|
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("798347")));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -95,7 +98,7 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
public void playerContent() {
|
public void playerContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "kahf2rw5Uuk+652f55f6943ee2f75d8e4fa590b4ec65fd007f8c", new ArrayList<>()));
|
Logger.t("playerContent").d(spider.playerContent("轉存原畫", "/vodplay/798347-2-9.html", new ArrayList<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,24 +6,35 @@ 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 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;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
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.Locale;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class QxiTv extends Spider {
|
public class QxiTv extends Spider {
|
||||||
|
|
||||||
private static final String siteUrl = "https://7xi.tv";
|
private static final String siteUrl = "https://7xi.tv";
|
||||||
private static final String cateUrl = siteUrl + "/vodtype/";
|
private static final String cateUrl = siteUrl + "/index.php/api/vod";
|
||||||
private static final String detailUrl = siteUrl + "/videos/";
|
private static final String detailUrl = siteUrl + "/voddetail/";
|
||||||
private static final String searchUrl = siteUrl + "/search/";
|
private static final String searchUrl = siteUrl + "/vodsearch/page/1/wd/";
|
||||||
|
|
||||||
private HashMap<String, String> getHeaders() {
|
private HashMap<String, String> getHeaders() {
|
||||||
HashMap<String, String> headers = new HashMap<>();
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
@@ -35,19 +46,22 @@ 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(cateUrl.concat("1.html"), getHeaders()));
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||||
// for (Element element : doc.select(".header_nav1 div.this-wap > a")) {
|
for (Element element : doc.select("h4.title-h")) {
|
||||||
// String typeId = element.attr("href");
|
String typeId = element.select("a").attr("href");
|
||||||
// String typeName = element.text();
|
String typeName = element.select("span").text();
|
||||||
// classes.add(new Class(typeId, typeName));
|
if (!"".equals(typeName)) {
|
||||||
// }
|
classes.add(new Class(typeId, typeName));
|
||||||
doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
}
|
||||||
for (Element element : doc.select("div.public-list-div")) {
|
}
|
||||||
|
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");
|
||||||
String url = element.select("a").attr("href");
|
String url = element.attr("href");
|
||||||
String name = element.select("a.title").text();
|
String name = element.attr("title");
|
||||||
if (pic.endsWith(".gif") || name.isEmpty()) continue;
|
if (!pic.startsWith("http")) {
|
||||||
|
pic = siteUrl + pic;
|
||||||
|
}
|
||||||
String id = url.split("/")[2];
|
String id = url.split("/")[2];
|
||||||
list.add(new Vod(id, name, pic));
|
list.add(new Vod(id, name, pic));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -58,53 +72,137 @@ public class QxiTv extends Spider {
|
|||||||
return Result.string(classes, list);
|
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
|
@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<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
String target = cateUrl + tid + "/?mode=async&function=get_block&block_id=list_videos_common_videos_list&sort_by=post_date&from=" + String.format(Locale.getDefault(), "%02d", Integer.parseInt(pg)) + "&_=" + System.currentTimeMillis();
|
String target = cateUrl + tid;
|
||||||
Document doc = Jsoup.parse(OkHttp.string(target, getHeaders()));
|
HashMap<String, String> params = new HashMap<>();
|
||||||
for (Element element : doc.select("div.video-img-box")) {
|
params.put("type", tid.split("/")[2].replace(".html", ""));
|
||||||
String pic = element.select("img").attr("data-src");
|
params.put("page", pg);
|
||||||
String url = element.select("a").attr("href");
|
String time = String.valueOf(System.currentTimeMillis());
|
||||||
String name = element.select("div.detail > h6").text();
|
params.put("time", time);
|
||||||
String id = url.split("/")[4];
|
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));
|
list.add(new Vod(id, name, pic));
|
||||||
}
|
}
|
||||||
return Result.string(list);
|
Integer total = (Integer.parseInt(pg) + 1) * 20;
|
||||||
|
return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, 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("/"), getHeaders()));
|
Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0)).concat(".html"), getHeaders()));
|
||||||
String name = doc.select("meta[property=og:title]").attr("content");
|
String name = doc.select("div.this-desc-title").text();
|
||||||
String pic = doc.select("meta[property=og:image]").attr("content");
|
String pic = doc.select("div.this-pic-bj").attr("style").replace("background-image: url('", "").replace("')", "");
|
||||||
String year = doc.select("span.inactive-color").get(0).text();
|
String year = doc.select("div.this-desc-info > span").get(1).text();
|
||||||
|
|
||||||
|
// 播放源
|
||||||
|
Elements tabs = doc.select("a.swiper-slide");
|
||||||
|
Elements list = doc.select("div.anthology-list-box.none");
|
||||||
|
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");
|
||||||
|
}else {
|
||||||
|
liUrl = liUrl + li.get(i1).text() + "$" + li.get(i1).attr("href");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!"".equals(PlayUrl)) {
|
||||||
|
PlayUrl = PlayUrl + "$$$" + liUrl;
|
||||||
|
}else {
|
||||||
|
PlayUrl = PlayUrl + liUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
vod.setVodId(ids.get(0));
|
vod.setVodId(ids.get(0));
|
||||||
vod.setVodPic(pic);
|
vod.setVodPic(pic);
|
||||||
vod.setVodYear(year.replace("上市於 ", ""));
|
vod.setVodYear(year);
|
||||||
vod.setVodName(name);
|
vod.setVodName(name);
|
||||||
vod.setVodPlayFrom("Jable");
|
vod.setVodPlayFrom(PlayFrom);
|
||||||
vod.setVodPlayUrl("播放$" + Util.getVar(doc.html(), "hlsUrl"));
|
vod.setVodPlayUrl(PlayUrl);
|
||||||
return Result.string(vod);
|
return Result.string(vod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String searchContent(String key, boolean quick) throws Exception {
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
Document doc = Jsoup.parse(OkHttp.string(searchUrl.concat(URLEncoder.encode(key)).concat("/"), getHeaders()));
|
Document doc = Jsoup.parse(OkHttp.string(searchUrl.concat(URLEncoder.encode(key)).concat(".html"), getHeaders()));
|
||||||
for (Element element : doc.select("div.video-img-box")) {
|
for (Element element : doc.select("a.public-list-exp")) {
|
||||||
|
try {
|
||||||
String pic = element.select("img").attr("data-src");
|
String pic = element.select("img").attr("data-src");
|
||||||
String url = element.select("a").attr("href");
|
String url = element.attr("href");
|
||||||
String name = element.select("div.detail > h6").text();
|
String name = element.attr("title");
|
||||||
String id = url.split("/")[4];
|
if (!pic.startsWith("http")) {
|
||||||
|
pic = siteUrl + pic;
|
||||||
|
}
|
||||||
|
String id = url.split("/")[2];
|
||||||
list.add(new Vod(id, name, pic));
|
list.add(new Vod(id, name, pic));
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Result.string(list);
|
return Result.string(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
return Result.get().url(id).header(getHeaders()).string();
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl.concat(id),getHeaders()));
|
||||||
|
String regex = "\"url\":\"(.*?)m3u8\",";
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(doc.html());
|
||||||
|
String url = "";
|
||||||
|
if (matcher.find()) {
|
||||||
|
url = matcher.group(1);
|
||||||
|
url = url.replace("\\/","/") + "m3u8";
|
||||||
|
}
|
||||||
|
return Result.get().url(url).header(getHeaders()).string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
045e8d2515cad8be77bc5e7a0aab8107
|
3149aff5aaa53271e9ab60f5341b76e7
|
||||||
@@ -99,6 +99,14 @@
|
|||||||
"filterable": 0,
|
"filterable": 0,
|
||||||
"ext": "3865f0ab8f124688ad786a262af9b940"
|
"ext": "3865f0ab8f124688ad786a262af9b940"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "JustLive",
|
||||||
|
"name": "JustLive",
|
||||||
|
"type": 3,
|
||||||
|
"api": "csp_JustLive",
|
||||||
|
"searchable": 1,
|
||||||
|
"filterable": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "18AV",
|
"key": "18AV",
|
||||||
"name": "18AV",
|
"name": "18AV",
|
||||||
@@ -131,6 +139,14 @@
|
|||||||
"searchable": 1,
|
"searchable": 1,
|
||||||
"filterable": 1
|
"filterable": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "QxiTv",
|
||||||
|
"name": "7xiTv",
|
||||||
|
"type": 3,
|
||||||
|
"api": "csp_QxiTv",
|
||||||
|
"searchable": 1,
|
||||||
|
"filterable": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "J91",
|
"key": "J91",
|
||||||
"name": "J91",
|
"name": "J91",
|
||||||
|
|||||||
Reference in new issue
Block a user