天翼问题修复
This commit is contained in:
parent
b47e9b12ac
commit
c96d3dcca1
|
|
@ -23,7 +23,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class TianyiApi {
|
||||
private String apiUrl = "https://cloud.189.cn/api/open/share/";
|
||||
public static final String URL_START = "https://cloud.189.cn/";
|
||||
public static final String URL_CONTAIN = "cloud.189.cn/";
|
||||
|
||||
|
||||
private Map<String, JsonObject> shareTokenCache = new HashMap<>();
|
||||
|
|
@ -221,41 +221,30 @@ public class TianyiApi {
|
|||
|
||||
|
||||
public ShareData getShareData(String url, String accessCode) {
|
||||
String shareCode = "";
|
||||
// 第一种匹配规则:使用预编译的 regex
|
||||
Matcher matcher = Pattern.compile("https:\\/\\/cloud\\.189\\.cn\\/web\\/share\\?code=([^&]+)").matcher(url);
|
||||
if (matcher.find() && matcher.group(1) != null) {
|
||||
shareCode = matcher.group(1);
|
||||
// 从shareCode中提取访问码
|
||||
Matcher accessMatcher = Pattern.compile("访问码:([a-zA-Z0-9]+)").matcher(shareCode);
|
||||
// 从整个URL中直接提取访问码,无论格式如何
|
||||
Matcher accessMatcher = Pattern.compile("访问码[::]([a-zA-Z0-9]+)").matcher(url);
|
||||
if (accessMatcher.find()) {
|
||||
accessCode = accessMatcher.group(1);
|
||||
|
||||
} else {
|
||||
} else if (accessCode == null || accessCode.isEmpty()) {
|
||||
accessCode = "";
|
||||
}
|
||||
|
||||
String shareCode = null;
|
||||
// 第一种匹配规则:兼容http和https
|
||||
Matcher matcher = Pattern.compile("https?:\\/\\/cloud\\.189\\.cn\\/web\\/share\\?code=([^&\\s]+)").matcher(url);
|
||||
if (matcher.find() && matcher.group(1) != null) {
|
||||
shareCode = matcher.group(1);
|
||||
} else {
|
||||
// 第二种匹配规则:直接匹配 cloud.189.cn/t/ 格式
|
||||
Matcher fallbackMatcher = Pattern.compile("https://cloud\\.189\\.cn/t/([^&]+)").matcher(url);
|
||||
// 第二种匹配规则:直接匹配 cloud.189.cn/t/ 格式,兼容http和https,匹配到空格前
|
||||
Matcher fallbackMatcher = Pattern.compile("https?:\\/\\/cloud\\.189\\.cn\\/t/([^\\s]+)").matcher(url);
|
||||
if (fallbackMatcher.find()) {
|
||||
shareCode = fallbackMatcher.group(1);
|
||||
} else {
|
||||
shareCode = null;
|
||||
}
|
||||
// 再次尝试从shareCode提取访问码
|
||||
if (shareCode != null) {
|
||||
Matcher accessMatcher = Pattern.compile("访问码:([a-zA-Z0-9]+)").matcher(shareCode);
|
||||
accessCode = accessMatcher.find() ? accessMatcher.group(1) : "";
|
||||
} else {
|
||||
accessCode = "";
|
||||
}
|
||||
}
|
||||
|
||||
shareCode = shareCode.split("(访问码")[0].trim();
|
||||
ShareData shareData = new ShareData(shareCode, "0");
|
||||
shareData.setSharePwd(accessCode);
|
||||
return shareData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.github.catvod.spider;
|
|||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.github.catvod.api.Pan123Api;
|
||||
import com.github.catvod.api.TianyiApi;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.utils.Json;
|
||||
|
|
@ -14,7 +13,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.github.catvod.api.TianyiApi.URL_START;
|
||||
import static com.github.catvod.api.TianyiApi.URL_CONTAIN;
|
||||
|
||||
/**
|
||||
* @author ColaMint & Adam & FongMi
|
||||
|
|
@ -60,7 +59,7 @@ public class Cloud extends Spider {
|
|||
return quark.detailContent(shareUrl);
|
||||
} /*else if (shareUrl.get(0).matches(Util.patternUC)) {
|
||||
return uc.detailContent(shareUrl);
|
||||
} */ else if (shareUrl.get(0).startsWith(TianyiApi.URL_START)) {
|
||||
} */ else if (shareUrl.get(0).contains(URL_CONTAIN)) {
|
||||
return tianYi.detailContent(shareUrl);
|
||||
} else if (shareUrl.get(0).contains(YiDongYun.URL_START)) {
|
||||
return yiDongYun.detailContent(shareUrl);
|
||||
|
|
@ -107,7 +106,7 @@ public class Cloud extends Spider {
|
|||
from.add(quark.detailContentVodPlayFrom(List.of(shareLink), i));
|
||||
} /*else if (shareLink.matches(Util.patternAli)) {
|
||||
from.add(ali.detailContentVodPlayFrom(List.of(shareLink), i));
|
||||
} */ else if (shareLink.startsWith(URL_START)) {
|
||||
} */ else if (shareLink.contains(URL_CONTAIN)) {
|
||||
from.add(tianYi.detailContentVodPlayFrom(List.of(shareLink), i));
|
||||
} else if (shareLink.contains(YiDongYun.URL_START)) {
|
||||
from.add(yiDongYun.detailContentVodPlayFrom(List.of(shareLink), i));
|
||||
|
|
@ -131,7 +130,7 @@ public class Cloud extends Spider {
|
|||
urls.add(quark.detailContentVodPlayUrl(List.of(shareLink)));
|
||||
}/* else if (shareLink.matches(Util.patternAli)) {
|
||||
urls.add(ali.detailContentVodPlayUrl(List.of(shareLink)));
|
||||
} */ else if (shareLink.startsWith(URL_START)) {
|
||||
} */ else if (shareLink.contains(URL_CONTAIN)) {
|
||||
urls.add(tianYi.detailContentVodPlayUrl(List.of(shareLink)));
|
||||
} else if (shareLink.contains(YiDongYun.URL_START)) {
|
||||
urls.add(yiDongYun.detailContentVodPlayUrl(List.of(shareLink)));
|
||||
|
|
|
|||
|
|
@ -1,107 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
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 org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.github.catvod.bean.Class;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
public class Jable extends Spider {
|
||||
|
||||
private static final String siteUrl = "https://jable.tv";
|
||||
private static final String cateUrl = siteUrl + "/categories/";
|
||||
private static final String detailUrl = siteUrl + "/videos/";
|
||||
private static final String searchUrl = siteUrl + "/search/";
|
||||
|
||||
private HashMap<String, String> getHeaders() {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", "PostmanRuntime/7.36.3");
|
||||
headers.put("Host", "jable.tv");
|
||||
headers.put("Postman-Token", "33290483-3c8d-413f-a160-0d3aea9e6f95");
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
List<Class> classes = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeaders()));
|
||||
for (Element element : doc.select("div.img-box > a")) {
|
||||
String typeId = element.attr("href").split("/")[4];
|
||||
String typeName = element.select("div.absolute-center > h4").text();
|
||||
classes.add(new Class(typeId, typeName));
|
||||
}
|
||||
doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||
for (Element element : doc.select("div.video-img-box")) {
|
||||
String pic = element.select("img").attr("data-src");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("div.detail > h6").text();
|
||||
if (pic.endsWith(".gif") || name.isEmpty()) continue;
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(classes, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
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();
|
||||
Document doc = Jsoup.parse(OkHttp.string(target, getHeaders()));
|
||||
for (Element element : doc.select("div.video-img-box")) {
|
||||
String pic = element.select("img").attr("data-src");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("div.detail > h6").text();
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0)).concat("/"), getHeaders()));
|
||||
String name = doc.select("meta[property=og:title]").attr("content");
|
||||
String pic = doc.select("meta[property=og:image]").attr("content");
|
||||
String year = doc.select("span.inactive-color").get(0).text();
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodPic(pic);
|
||||
vod.setVodYear(year.replace("上市於 ", ""));
|
||||
vod.setVodName(name);
|
||||
vod.setVodPlayFrom("Jable");
|
||||
vod.setVodPlayUrl("播放$" + Util.getVar(doc.html(), "hlsUrl"));
|
||||
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)).concat("/"), getHeaders()));
|
||||
for (Element element : doc.select("div.video-img-box")) {
|
||||
String pic = element.select("img").attr("data-src");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("div.detail > h6").text();
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).header(getHeaders()).string();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
package com.github.catvod.spider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
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.Util;
|
||||
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Qile
|
||||
*/
|
||||
public class JavDb extends Spider {
|
||||
|
||||
private static String siteUrl = "https://javdb523.com";
|
||||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
if (!extend.isEmpty()) siteUrl = extend;
|
||||
}
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> header = new HashMap<>();
|
||||
header.put("User-Agent", Util.CHROME);
|
||||
header.put("Referer", siteUrl + "/");
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("", "censored", "uncensored", "western");
|
||||
List<String> typeNames = Arrays.asList("全部", "有码", "无码", "欧美");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(classes, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String cateUrl = siteUrl + String.format("/%s?page=%s", tid, pg);
|
||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) throws Exception {
|
||||
Document doc = Jsoup.parse(OkHttp.string(ids.get(0), getHeader()));
|
||||
if (doc.text().contains("歡迎登入")) return Result.error("该资源需要登入");
|
||||
List<String> vodItems = new ArrayList<>();
|
||||
Elements sourceList = doc.select(".item.columns");
|
||||
for (Element a : sourceList) {
|
||||
String episodeUrl = a.select("div a").attr("href");
|
||||
String episodeName = a.select("div a").text();
|
||||
vodItems.add(episodeName + "$" + episodeUrl);
|
||||
}
|
||||
Elements elements = doc.select(".panel-block");
|
||||
String classifyName = "";
|
||||
String year = "";
|
||||
String area = "";
|
||||
String remark = "";
|
||||
for (Element element : elements) {
|
||||
String text = element.text();
|
||||
if (text.startsWith("類別:")) {
|
||||
classifyName = element.select("span a").text();
|
||||
} else if (text.startsWith("片商:")) {
|
||||
area = element.select("span a").text();
|
||||
} else if (text.startsWith("日期:")) {
|
||||
year = element.select("span").text();
|
||||
} else if (text.startsWith("時長:")) {
|
||||
remark = element.select("span").text();
|
||||
}
|
||||
}
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodYear(year);
|
||||
vod.setVodArea(area);
|
||||
vod.setVodRemarks(remark);
|
||||
vod.setTypeName(classifyName);
|
||||
vod.setVodContent(ids.get(0));
|
||||
vod.setVodPlayFrom("Qile");
|
||||
vod.setVodPlayUrl(TextUtils.join("#", vodItems));
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws Exception {
|
||||
String searchUrl = siteUrl + "/search?q=" + Uri.encode(key) + "&f=all";
|
||||
Document doc = Jsoup.parse(OkHttp.string(searchUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
for (Element li : doc.select(".item")) {
|
||||
String vid = siteUrl + li.select("a").attr("href");
|
||||
String name = li.select("a").attr("title");
|
||||
String pic = li.select("img").attr("src");
|
||||
list.add(new Vod(vid, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||
return Result.get().url(id).header(getHeader()).string();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
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.ProxyVideo;
|
||||
import com.github.catvod.utils.Util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
public class Supjav extends Spider {
|
||||
|
||||
private static final String siteUrl = "https://supjav.com/zh/";
|
||||
private static final String playUrl = "https://lk1.supremejav.com/";
|
||||
|
||||
private HashMap<String, String> getHeaders() {
|
||||
return getHeaders(siteUrl);
|
||||
}
|
||||
|
||||
private HashMap<String, String> getHeaders(String referer) {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("Referer", "https://supjav.com/");
|
||||
headers.put("Host", "supjav.com");
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
return headers;
|
||||
}
|
||||
|
||||
private HashMap<String, String> getTVVideoHeaders(String referer) {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("Referer", referer);
|
||||
headers.put("User-Agent", Util.CHROME);
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
List<Class> classes = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders()));
|
||||
for (Element element : doc.select("ul.nav > li > a")) {
|
||||
String href = element.attr("href");
|
||||
if (href.split("/").length < 5) continue;
|
||||
String typeId = href.replace(siteUrl, "");
|
||||
String typeName = element.text();
|
||||
classes.add(new Class(typeId, typeName));
|
||||
}
|
||||
for (Element element : doc.select("div.post")) {
|
||||
String src = element.select("img").attr("src");
|
||||
String data = element.select("img").attr("data-original");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("a").attr("title");
|
||||
String pic = StringUtils.isEmpty(data) ? src : data;
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(classes, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl + tid + "/page/" + pg, getHeaders()));
|
||||
for (Element element : doc.select("div.post")) {
|
||||
String pic = element.select("img").attr("data-original");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("a").attr("title");
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String detailContent(List<String> ids) {
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl.concat(ids.get(0)), getHeaders()));
|
||||
String name = doc.select("div.post-meta > img").attr("alt");
|
||||
String img = doc.select("div.post-meta > img").attr("src");
|
||||
String type = doc.select("p.cat > a").text();
|
||||
String director = "", actor = "";
|
||||
for (Element p : doc.select("div.cats > p")) {
|
||||
if (p.select("span").text().contains("Maker")) {
|
||||
director = p.select("a").text();
|
||||
}
|
||||
if (p.select("span").text().contains("Cast")) {
|
||||
actor = p.select("a").text();
|
||||
}
|
||||
}
|
||||
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(ids.get(0));
|
||||
vod.setVodPic(img);
|
||||
vod.setVodName(name);
|
||||
vod.setVodActor(actor);
|
||||
vod.setVodDirector(director);
|
||||
vod.setTypeName(type);
|
||||
|
||||
Map<String, String> sites = new LinkedHashMap<>();
|
||||
Elements sources = doc.select("a.btn-server");
|
||||
for (int i = 0; i < sources.size(); i++) {
|
||||
Element source = sources.get(i);
|
||||
String sourceName = source.text();
|
||||
if (sourceName.equals("TV")) continue;
|
||||
String sourceUrl = source.attr("data-link");
|
||||
sites.put(sourceName, "播放" + "$" + sourceUrl);
|
||||
}
|
||||
if (!sites.isEmpty()) {
|
||||
vod.setVodPlayFrom(StringUtils.join(sites.keySet(), "$$$"));
|
||||
vod.setVodPlayUrl(StringUtils.join(sites.values(), "$$$"));
|
||||
}
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchContent(String key, boolean quick) throws UnsupportedEncodingException {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
Document doc = Jsoup.parse(OkHttp.string(siteUrl.concat("?s=").concat(URLEncoder.encode(key, "UTF-8")), getHeaders()));
|
||||
for (Element element : doc.select("div.post")) {
|
||||
String pic = element.select("img").attr("data-original");
|
||||
String url = element.select("a").attr("href");
|
||||
String name = element.select("a").attr("title");
|
||||
String id = url.split("/")[4];
|
||||
list.add(new Vod(id, name, pic));
|
||||
}
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws URISyntaxException, IOException {
|
||||
String redirect = OkHttp.getLocation(playUrl + "supjav.php?c=" + new StringBuilder(id).reverse(), getTVVideoHeaders(playUrl + "supjav.php?l=" + id + "&bg=undefined"));
|
||||
switch (flag) {
|
||||
case "TV":
|
||||
return parseTV(redirect);
|
||||
case "ST":
|
||||
return parseST(redirect);
|
||||
case "FST":
|
||||
return parseFST(redirect);
|
||||
case "VOE":
|
||||
return parseVOE(redirect);
|
||||
default:
|
||||
return Result.get().url(id).parse().string();
|
||||
}
|
||||
}
|
||||
|
||||
private String parseVOE(String redirect) {
|
||||
String data = OkHttp.string(redirect, getTVVideoHeaders(playUrl));
|
||||
redirect = Util.findByRegex("window.location.href = '(.*?)';", data, 1);
|
||||
data = OkHttp.string(redirect, getTVVideoHeaders(playUrl));
|
||||
String url=Util.findByRegex("prompt\\(\"Node\",(.*?)\\);", data, 1).trim().replace("\"", "");
|
||||
|
||||
return Result.get().url(ProxyVideo.buildCommonProxyUrl(url, Util.webHeaders(redirect))).header(getHeaders(redirect)).string();
|
||||
}
|
||||
|
||||
private String parseFST(String redirect) {
|
||||
String data = OkHttp.string(redirect, getTVVideoHeaders(playUrl));
|
||||
return Result.get().url(Util.findByRegex("file:\"(.*?)\"}]", data, 1)).header(getHeaders(redirect)).string();
|
||||
}
|
||||
|
||||
private String parseTV(String redirect) throws MalformedURLException {
|
||||
String data = OkHttp.string(redirect, getTVVideoHeaders(Util.getHost(redirect)));
|
||||
return Result.get().url(Util.getVar(data, "urlPlay")).header(getTVVideoHeaders(Util.getHost(redirect))).string();
|
||||
}
|
||||
|
||||
private String parseST(String redirect) throws IOException {
|
||||
String data = OkHttp.string(redirect, getTVVideoHeaders(playUrl));
|
||||
String robot = Jsoup.parse(data).getElementById("robotlink").text();
|
||||
robot = robot.substring(0, robot.indexOf("&token=") + 7);
|
||||
for (String text : data.split("&token=")) {
|
||||
if (!text.contains("').substring(")) continue;
|
||||
robot = "https:/" + robot + text.split("'")[0] + "&stream=1";
|
||||
String url = OkHttp.getLocation(robot, getTVVideoHeaders(redirect));
|
||||
return Result.get().url(ProxyVideo.buildCommonProxyUrl(url, Util.webHeaders(robot))).header(getHeaders(redirect)).string();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String parseDS(String redirect) throws URISyntaxException, IOException {
|
||||
String host = "https://" + Util.getHost(redirect);
|
||||
redirect = host + OkHttp.getLocation(redirect, getTVVideoHeaders(playUrl));
|
||||
String data = OkHttp.string(redirect, getHeaders());
|
||||
for (String text : data.split("'")) {
|
||||
if (!text.startsWith("/pass_md5/")) continue;
|
||||
String token = text.split("/")[3];
|
||||
String url = OkHttp.string(host + text, getHeaders(redirect));
|
||||
url = url + getDSRnd() + "?token=" + token + "&expiry=" + System.currentTimeMillis();
|
||||
return Result.get().url(url).header(getHeaders(redirect)).string();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getDSRnd() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for (int o = 0; o < 10; o++)
|
||||
sb.append(t.charAt((int) Math.floor(Math.random() * t.length())));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -21,9 +21,9 @@ public class TianyiApiTest {
|
|||
@Test
|
||||
public void getShareData() throws Exception {
|
||||
|
||||
com.github.catvod.bean.tianyi.ShareData shareData = TianyiApi.get().getShareData("https://cloud.189.cn/web/share?code=ZvEjUvq6FNr2", "");
|
||||
// com.github.catvod.bean.tianyi.ShareData shareData = TianyiApi.get().getShareData("https://cloud.189.cn/web/share?code=ZvEjUvq6FNr2", "");
|
||||
// TianyiApi.get().getVod(shareData);
|
||||
com.github.catvod.bean.tianyi.ShareData shareData1 = TianyiApi.get().getShareData("https://cloud.189.cn/web/share?code=2eyARfBzURZj(访问码:kz6y)", "");
|
||||
com.github.catvod.bean.tianyi.ShareData shareData1 = TianyiApi.get().getShareData("http://cloud.189.cn/t/3uIFJrzIFJV3(访问码:qf4b)", "");
|
||||
|
||||
// TianyiApi.get().getVod(shareData1);
|
||||
ShareData shareData2 = TianyiApi.get().getShareData("https://cloud.189.cn/t/ZvEjUvq6FNr2", "");
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
42679cde91765ee4f4a0de1d8c61a09a
|
||||
36b4ace1c06df34f4091ad727d7f8ea3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;42679cde91765ee4f4a0de1d8c61a09a",
|
||||
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;36b4ace1c06df34f4091ad727d7f8ea3",
|
||||
"lives": [
|
||||
{
|
||||
"name": "电视直播",
|
||||
|
|
|
|||
Loading…
Reference in New Issue