parent
c477b8e266
commit
85cccdf13c
@ -0,0 +1,104 @@ |
||||
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.OkHttpUtil; |
||||
import com.github.catvod.utils.Misc; |
||||
|
||||
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; |
||||
|
||||
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", Misc.CHROME); |
||||
return headers; |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) throws Exception { |
||||
List<Vod> list = new ArrayList<>(); |
||||
List<Class> classes = new ArrayList<>(); |
||||
Document doc = Jsoup.parse(OkHttpUtil.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(OkHttpUtil.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(OkHttpUtil.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(OkHttpUtil.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("播放$" + Misc.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(OkHttpUtil.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(); |
||||
} |
||||
} |
||||
@ -0,0 +1,83 @@ |
||||
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.OkHttpUtil; |
||||
import com.github.catvod.utils.Misc; |
||||
|
||||
import org.jsoup.Jsoup; |
||||
import org.jsoup.nodes.Document; |
||||
import org.jsoup.nodes.Element; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
public class Pig extends Spider { |
||||
|
||||
private static final String siteUrl = "https://pigav.com/"; |
||||
|
||||
private HashMap<String, String> getHeaders() { |
||||
HashMap<String, String> headers = new HashMap<>(); |
||||
headers.put("User-Agent", Misc.CHROME); |
||||
return headers; |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) throws Exception { |
||||
List<Vod> list = new ArrayList<>(); |
||||
List<Class> classes = new ArrayList<>(); |
||||
Document doc = Jsoup.parse(OkHttpUtil.string(siteUrl, getHeaders())); |
||||
for (Element element : doc.select("li.menu-item > a")) { |
||||
String typeId = element.attr("href").replace(siteUrl, ""); |
||||
String typeName = element.text(); |
||||
if (typeId.contains("goav.one")) break; |
||||
classes.add(new Class(typeId, typeName)); |
||||
} |
||||
for (Element element : doc.select("div.media")) { |
||||
String pic = element.select("span").attr("data-bgsrc"); |
||||
String url = element.select("a").attr("href"); |
||||
String name = element.select("a").attr("title"); |
||||
String id = url.replace(siteUrl, ""); |
||||
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 = siteUrl.concat(tid).concat("/page/").concat(pg); |
||||
Document doc = Jsoup.parse(OkHttpUtil.string(target, getHeaders())); |
||||
for (Element element : doc.select("div.media")) { |
||||
String pic = element.select("span").attr("data-bgsrc"); |
||||
String url = element.select("a").attr("href"); |
||||
String name = element.select("a").attr("title"); |
||||
String id = url.replace(siteUrl, ""); |
||||
list.add(new Vod(id, name, pic)); |
||||
} |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
Document doc = Jsoup.parse(OkHttpUtil.string(siteUrl.concat("/").concat(ids.get(0)), getHeaders())); |
||||
String url = doc.select("source").attr("src"); |
||||
String name = doc.select("h1.is-title").text(); |
||||
String pic = doc.select("video.video-js").attr("poster"); |
||||
Vod vod = new Vod(); |
||||
vod.setVodId(ids.get(0)); |
||||
vod.setVodPic(pic); |
||||
vod.setVodName(name); |
||||
vod.setVodPlayFrom("朱古力"); |
||||
vod.setVodPlayUrl("播放$" + url); |
||||
return Result.string(vod); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { |
||||
return Result.get().url(id).header(getHeaders()).string(); |
||||
} |
||||
} |
||||
@ -0,0 +1,192 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
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.OkHttpUtil; |
||||
import com.github.catvod.utils.Misc; |
||||
|
||||
import org.jsoup.Jsoup; |
||||
import org.jsoup.nodes.Document; |
||||
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.LinkedHashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
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("User-Agent", Misc.CHROME); |
||||
headers.put("Referer", referer); |
||||
return headers; |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) { |
||||
List<Vod> list = new ArrayList<>(); |
||||
List<Class> classes = new ArrayList<>(); |
||||
Document doc = Jsoup.parse(OkHttpUtil.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 = TextUtils.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(OkHttpUtil.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(OkHttpUtil.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("JPA")) continue; |
||||
String sourceUrl = source.attr("data-link"); |
||||
sites.put(sourceName, "播放" + "$" + sourceUrl); |
||||
} |
||||
if (sites.size() > 0) { |
||||
vod.setVodPlayFrom(TextUtils.join("$$$", sites.keySet())); |
||||
vod.setVodPlayUrl(TextUtils.join("$$$", sites.values())); |
||||
} |
||||
return Result.string(vod); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) { |
||||
List<Vod> list = new ArrayList<>(); |
||||
Document doc = Jsoup.parse(OkHttpUtil.string(siteUrl.concat("?s=").concat(URLEncoder.encode(key)), 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) { |
||||
Map<String, List<String>> respHeaders = new HashMap<>(); |
||||
OkHttpUtil.stringNoRedirect(playUrl + "supjav.php?c=" + new StringBuilder(id).reverse(), getHeaders(playUrl), respHeaders); |
||||
String redirect = OkHttpUtil.getRedirectLocation(respHeaders); |
||||
switch (flag) { |
||||
case "TV": |
||||
return parseTV(redirect); |
||||
case "ST": |
||||
return parseST(redirect); |
||||
case "DS": |
||||
return parseDS(redirect); |
||||
default: |
||||
return Result.get().url(id).parse().string(); |
||||
} |
||||
} |
||||
|
||||
private String parseTV(String redirect) { |
||||
String data = OkHttpUtil.string(redirect, getHeaders(playUrl)); |
||||
return Result.get().url(Misc.getVar(data, "urlPlay")).header(getHeaders(redirect)).string(); |
||||
} |
||||
|
||||
private String parseST(String redirect) { |
||||
Map<String, List<String>> respHeaders = new HashMap<>(); |
||||
String data = OkHttpUtil.string(redirect, getHeaders(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"; |
||||
OkHttpUtil.stringNoRedirect(robot, getHeaders(redirect), respHeaders); |
||||
String url = OkHttpUtil.getRedirectLocation(respHeaders); |
||||
return Result.get().url(url).header(getHeaders(redirect)).string(); |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
private String parseDS(String redirect) { |
||||
String host = "https://" + Uri.parse(redirect).getHost(); |
||||
Map<String, List<String>> respHeaders = new HashMap<>(); |
||||
OkHttpUtil.stringNoRedirect(redirect, getHeaders(playUrl), respHeaders); |
||||
redirect = host + OkHttpUtil.getRedirectLocation(respHeaders); |
||||
String data = OkHttpUtil.string(redirect, getHeaders()); |
||||
for (String text : data.split("'")) { |
||||
if (!text.startsWith("/pass_md5/")) continue; |
||||
String token = text.split("/")[3]; |
||||
String url = OkHttpUtil.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(); |
||||
} |
||||
} |
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1 +1 @@ |
||||
f56657fee19cd217607a458809c350b4 |
||||
0064f03c02c06b3670e9f5a9d16f53dc |
||||
|
||||
Loading…
Reference in new issue