Merge branch 'main' of https://github.com/FongMi/CatVodSpider
This commit is contained in:
commit
675392b4ee
|
|
@ -136,6 +136,10 @@ public class Drive {
|
||||||
return getHost() + (isNew() ? "/api/fs/search" : "/api/public/search");
|
return getHost() + (isNew() ? "/api/fs/search" : "/api/public/search");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String searchApi(String param) {
|
||||||
|
return getHost() + "/search?box=" + param + "&url=&type=video";
|
||||||
|
}
|
||||||
|
|
||||||
public Drive check() {
|
public Drive check() {
|
||||||
if (path == null) setPath(Uri.parse(getServer()).getPath());
|
if (path == null) setPath(Uri.parse(getServer()).getPath());
|
||||||
if (version == 0) setVersion(OkHttp.string(settingsApi()).contains("v2.") ? 2 : 3);
|
if (version == 0) setVersion(OkHttp.string(settingsApi()).contains("v2.") ? 2 : 3);
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ public class Item {
|
||||||
return TextUtils.isEmpty(thumb) ? "" : thumb;
|
return TextUtils.isEmpty(thumb) ? "" : thumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setThumb(String thumb) {
|
||||||
|
this.thumb = thumb;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return TextUtils.isEmpty(url) ? "" : url.startsWith("//") ? "http:" + url : url;
|
return TextUtils.isEmpty(url) ? "" : url.startsWith("//") ? "http:" + url : url;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Utils;
|
import com.github.catvod.utils.Utils;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -250,12 +253,39 @@ public class AList extends Spider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Vod> call() throws Exception {
|
public List<Vod> call() {
|
||||||
|
List<Vod> alist = alist();
|
||||||
|
return alist.size() > 0 ? alist : xiaoya();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> xiaoya() {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(drive.searchApi(keyword)));
|
||||||
|
for (Element a : doc.select("ul > a")) {
|
||||||
|
String[] splits = a.text().split("#");
|
||||||
|
if (!splits[0].contains("/")) continue;
|
||||||
|
int index = splits[0].lastIndexOf("/");
|
||||||
|
boolean file = Utils.isMedia(splits[0]);
|
||||||
|
Item item = new Item();
|
||||||
|
item.setType(file ? 0 : 1);
|
||||||
|
item.setThumb(splits.length > 3 ? splits[4] : "");
|
||||||
|
item.setPath("/" + splits[0].substring(0, index));
|
||||||
|
item.setName(splits[0].substring(index + 1));
|
||||||
|
list.add(item.getVod(drive, vodPic));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> alist() {
|
||||||
|
try {
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
String response = post(drive, drive.searchApi(), drive.params(keyword));
|
String response = post(drive, drive.searchApi(), drive.params(keyword));
|
||||||
List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response));
|
List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response));
|
||||||
for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive, vodPic));
|
for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive, vodPic));
|
||||||
return list;
|
return list;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.github.catvod.spider;
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.github.catvod.bean.Class;
|
import com.github.catvod.bean.Class;
|
||||||
|
|
@ -7,7 +8,6 @@ import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
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.Utils;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
|
@ -17,6 +17,8 @@ import java.net.URLDecoder;
|
||||||
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.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Doll extends Spider {
|
public class Doll extends Spider {
|
||||||
|
|
||||||
|
|
@ -61,24 +63,41 @@ public class Doll extends Spider {
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
String html = OkHttp.string(url + ids.get(0));
|
String html = OkHttp.string(url + ids.get(0));
|
||||||
Document doc = Jsoup.parse(html);
|
Document doc = Jsoup.parse(html);
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
String videoId = ids.get(0).split("/")[1].split("\\.")[0];
|
|
||||||
String pic = doc.select("meta[property=og:image]").attr("content");
|
String pic = doc.select("meta[property=og:image]").attr("content");
|
||||||
String name = doc.select("meta[property=og:title]").attr("content");
|
String name = doc.select("meta[property=og:title]").attr("content");
|
||||||
String voteTag = new String(Base64.decode(Utils.getVar(html, "voteTag").getBytes(), 0));
|
|
||||||
for (int i = 0; i < voteTag.length(); i++) sb.append(Character.toChars(voteTag.charAt(i) ^ videoId.charAt(i % videoId.length())));
|
|
||||||
String playUrl = URLDecoder.decode(new String(Base64.decode(sb.toString().getBytes(), 0)));
|
|
||||||
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.setVodName(name);
|
vod.setVodName(name);
|
||||||
vod.setVodPlayFrom("玩偶姐姐");
|
vod.setVodPlayFrom("玩偶姐姐");
|
||||||
vod.setVodPlayUrl("播放$" + playUrl);
|
vod.setVodPlayUrl("播放$" + url + ids.get(0));
|
||||||
return Result.string(vod);
|
return Result.string(vod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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).string();
|
String key = "";
|
||||||
|
String voteTag = "";
|
||||||
|
StringBuilder code = new StringBuilder();
|
||||||
|
String html = OkHttp.string(id);
|
||||||
|
Document doc = Jsoup.parse(html);
|
||||||
|
Matcher m = Pattern.compile("/video/(\\w+).html").matcher(id);
|
||||||
|
if (m.find()) key = m.group(1);
|
||||||
|
for (Element a : doc.select("script")) {
|
||||||
|
if (a.html().startsWith("var voteTag")) {
|
||||||
|
Pattern pattern = Pattern.compile("voteTag=\"([^&]+)\"");
|
||||||
|
Matcher matcher = pattern.matcher(a.html());
|
||||||
|
if (matcher.find()) voteTag = matcher.group(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(voteTag)) return Result.get().url(id).parse().string();
|
||||||
|
voteTag = new String(Base64.decode(voteTag, 0));
|
||||||
|
for (int i = 0; i < voteTag.length(); i++) {
|
||||||
|
int k = i % key.length();
|
||||||
|
code.append((char) (voteTag.charAt(i) ^ key.charAt(k)));
|
||||||
|
}
|
||||||
|
String playUrl = URLDecoder.decode(new String(Base64.decode(code.toString(), 0)));
|
||||||
|
return Result.get().url(playUrl).string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class Local extends Spider {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.getName().startsWith(".")) continue;
|
if (file.getName().startsWith(".")) continue;
|
||||||
if (file.isDirectory()) folders.add(create(file));
|
if (file.isDirectory()) folders.add(create(file));
|
||||||
else if (Utils.MEDIA.contains(Utils.getExt(file.getName()))) media.add(create(file));
|
else if (Utils.isMedia(file.getName())) media.add(create(file));
|
||||||
}
|
}
|
||||||
items.addAll(folders);
|
items.addAll(folders);
|
||||||
items.addAll(media);
|
items.addAll(media);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public class WebDAV extends Spider {
|
||||||
Sorter.sort("name", "asc", parents);
|
Sorter.sort("name", "asc", parents);
|
||||||
List<String> playUrls = new ArrayList<>();
|
List<String> playUrls = new ArrayList<>();
|
||||||
for (DavResource item : parents) {
|
for (DavResource item : parents) {
|
||||||
if (Utils.MEDIA.contains(getExt(item))) {
|
if (Utils.isMedia(item.getName())) {
|
||||||
playUrls.add(item.getName() + "$" + drive.getName() + item.getPath() + findSubs(drive, item, subs));
|
playUrls.add(item.getName() + "$" + drive.getName() + item.getPath() + findSubs(drive, item, subs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,11 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
|
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|http((?!http).)*?video/tos*");
|
||||||
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36";
|
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36";
|
||||||
public static final String ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
public static final String ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
||||||
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "mp3", "aac", "flac", "m4a", "ape", "ogg");
|
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "iso", "mpg", "ts", "mp3", "aac", "flac", "m4a", "ape", "ogg");
|
||||||
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|" + "http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|" + "http((?!http).)*?video/tos*");
|
public static final List<String> SUB = Arrays.asList("srt", "ass", "ssa", "vtt");
|
||||||
|
|
||||||
public static boolean isVip(String url) {
|
public static boolean isVip(String url) {
|
||||||
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
|
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
|
||||||
|
|
@ -59,11 +60,15 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSub(String ext) {
|
public static boolean isSub(String ext) {
|
||||||
return ext.equals("srt") || ext.equals("ass") || ext.equals("ssa") || ext.equals("vtt");
|
return SUB.contains(ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isMedia(String text) {
|
||||||
|
return MEDIA.contains(getExt(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getExt(String name) {
|
public static String getExt(String name) {
|
||||||
return name.substring(name.lastIndexOf(".") + 1);
|
return name.contains(".") ? name.substring(name.lastIndexOf(".") + 1) : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSize(double size) {
|
public static String getSize(double size) {
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
da248d3decd2fb6776b2ce39013c3e6e
|
08e60753eb29394b75c088e1f06dfb17
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;da248d3decd2fb6776b2ce39013c3e6e",
|
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;08e60753eb29394b75c088e1f06dfb17",
|
||||||
"wallpaper": "https://gao.chuqiuyu.tk",
|
"wallpaper": "https://gao.chuqiuyu.tk",
|
||||||
"sites": [
|
"sites": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;da248d3decd2fb6776b2ce39013c3e6e",
|
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;08e60753eb29394b75c088e1f06dfb17",
|
||||||
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
|
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
|
||||||
"sites": [
|
"sites": [
|
||||||
{
|
{
|
||||||
|
|
@ -65,6 +65,15 @@
|
||||||
"searchable": 1,
|
"searchable": 1,
|
||||||
"changeable": 1
|
"changeable": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "haiwaikan",
|
||||||
|
"name": "海外看",
|
||||||
|
"type": 1,
|
||||||
|
"api": "https://haiwaikan.com/api.php/provide/vod",
|
||||||
|
"searchable": 1,
|
||||||
|
"changeable": 1,
|
||||||
|
"proxy": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "暴風",
|
"key": "暴風",
|
||||||
"name": "暴風",
|
"name": "暴風",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue