Compare commits
5 Commits
1da43828a8
...
185bbb367c
| Author | SHA1 | Date |
|---|---|---|
|
|
185bbb367c | 11 months ago |
|
|
c47efb2875 | 11 months ago |
|
|
5ce8752c28 | 11 months ago |
|
|
e9a8bb9f90 | 11 months ago |
|
|
63a8a232e3 | 11 months ago |
@ -0,0 +1,112 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.content.Context; |
||||
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.json.JSONArray; |
||||
import org.json.JSONObject; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author leospring |
||||
* 星牙短剧 |
||||
*/ |
||||
public class AppXY extends Spider { |
||||
|
||||
private String auth; |
||||
|
||||
private Map<String, String> getHeader() { |
||||
Map<String, String> map = new HashMap<>(); |
||||
map.put("User-Agent", "okhttp/4.10.0"); |
||||
if (!TextUtils.isEmpty(auth)) map.put("Authorization", auth); |
||||
return map; |
||||
} |
||||
|
||||
@Override |
||||
public void init(Context context, String extend) throws Exception { |
||||
String s = System.currentTimeMillis() + ""; |
||||
Map<String, String> map = new HashMap<>(); |
||||
map.put("device", Util.MD5(s)); |
||||
map.put("install_first_open", "true"); |
||||
map.put("first_install_time", s); |
||||
map.put("last_update_time", s); |
||||
auth = new JSONObject(OkHttp.post("https://app.whjzjx.cn/v1/account/login", map, getHeader()).getBody()).optJSONObject("data").optString("token"); |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) throws Exception { |
||||
ArrayList<Class> classes = new ArrayList<>(); |
||||
JSONArray array = new JSONObject(OkHttp.string("https://app.whjzjx.cn/cloud/v2/theater/classes", getHeader())).optJSONObject("data").optJSONArray("list"); |
||||
for (int i = 0; i < array.length(); ++i) { |
||||
JSONObject object = array.optJSONObject(i); |
||||
if (!object.optString("show_type").contains("Bookstore")) { |
||||
classes.add(new Class(object.optString("id"), object.optString("class_name"))); |
||||
} |
||||
} |
||||
return Result.string(classes, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception { |
||||
List<Vod> videos = new ArrayList<>(); |
||||
String class2Id = extend.get("class2_id"); |
||||
if (class2Id == null) class2Id = "0"; |
||||
JSONArray array = new JSONObject(OkHttp.string(("https://app.whjzjx.cn/cloud/v2/theater/home_page?theater_class_id=" + tid + "&class2_ids=" + class2Id + "&type=1&page_num=" + pg + "&page_size=24"), getHeader())).optJSONObject("data").optJSONArray("list"); |
||||
for (int v = 0; v < array.length(); ++v) { |
||||
JSONObject object = array.optJSONObject(v).optJSONObject("theater"); |
||||
videos.add(new Vod(object.optString("id"), object.optString("title"), object.optString("cover_url"), object.optString("total") + "集")); |
||||
} |
||||
return Result.string(videos); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
Vod vod = new Vod(); |
||||
JSONObject object = new JSONObject(OkHttp.string(("https://app.whjzjx.cn/v2/theater_parent/detail?theater_parent_id=" + ids.get(0)), getHeader())).optJSONObject("data"); |
||||
vod.setVodId(ids.get(0)); |
||||
vod.setVodName(object.optString("title")); |
||||
vod.setVodPic(object.optString("cover_url")); |
||||
vod.setTypeName(object.optJSONArray("desc_tags").join(",").replace("\"", "")); |
||||
vod.setVodContent(object.optString("introduction")); |
||||
ArrayList<String> playUrls = new ArrayList<>(); |
||||
ArrayList<String> playFrom = new ArrayList<>(); |
||||
playFrom.add("leospring"); |
||||
JSONArray array = object.optJSONArray("theaters"); |
||||
ArrayList<String> urlNames = new ArrayList<>(); |
||||
for (int i = 0; i < array.length(); ++i) { |
||||
object = array.optJSONObject(i); |
||||
urlNames.add(object.optString("num") + "$" + object.optString("son_video_url")); |
||||
} |
||||
playUrls.add(TextUtils.join("#", urlNames)); |
||||
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom)); |
||||
vod.setVodPlayUrl(TextUtils.join("$$$", playUrls)); |
||||
return Result.string(vod); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> flags) throws Exception { |
||||
return Result.get().url(id).toString(); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) throws Exception { |
||||
List<Vod> list = new ArrayList<>(); |
||||
JSONArray array = new JSONObject(OkHttp.post("https://app.whjzjx.cn/v3/search", new JSONObject().put("text", key).toString(), getHeader()).getBody()).optJSONObject("data").optJSONObject("theater").optJSONArray("search_data"); |
||||
for (int i = 0; i < array.length(); ++i) { |
||||
JSONObject object = array.optJSONObject(i); |
||||
list.add(new Vod(object.optString("id"), object.optString("title"), object.optString("cover_url"), object.optString("score_str"))); |
||||
} |
||||
return Result.string(list); |
||||
} |
||||
} |
||||
@ -0,0 +1,171 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.content.Context; |
||||
import android.net.Uri; |
||||
|
||||
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.Crypto; |
||||
import com.github.catvod.utils.Util; |
||||
|
||||
import org.json.JSONObject; |
||||
import org.jsoup.Jsoup; |
||||
import org.jsoup.nodes.Document; |
||||
import org.jsoup.nodes.Element; |
||||
import org.jsoup.select.Elements; |
||||
|
||||
import java.text.SimpleDateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Qile |
||||
* @date 2024-10-06 |
||||
*/ |
||||
public class YHDM extends Spider { |
||||
|
||||
private static String siteUrl = "https://www.857fans.com"; |
||||
private final Map<String, String> configCache = new HashMap<>(); |
||||
|
||||
private Map<String, String> getHeader() { |
||||
Map<String, String> header = new HashMap<>(); |
||||
header.put("User-Agent", Util.CHROME); |
||||
return header; |
||||
} |
||||
|
||||
@Override |
||||
public void init(Context context, String extend) throws Exception { |
||||
if (!extend.isEmpty()) siteUrl = extend; |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) throws Exception { |
||||
List<Class> classes = new ArrayList<>(); |
||||
List<String> typeIds = Arrays.asList("guochandongman", "ribendongman", "dongmandianying", "omeidongman"); |
||||
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(".stui-vodlist.clearfix .myui-vodlist__box")) { |
||||
String vid = li.select("a").attr("href"); |
||||
String name = li.select("a").attr("title"); |
||||
String pic = li.select("a").attr("data-original"); |
||||
if (!pic.startsWith("http")) pic = siteUrl + pic; |
||||
String remark = li.select(".pic-text.text-right").text(); |
||||
String year = li.select(".tag").text(); |
||||
list.add(new Vod(vid, name, pic, remark, year)); |
||||
} |
||||
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("/type/%s-%s.html", tid, pg); |
||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeader())); |
||||
List<Vod> list = new ArrayList<>(); |
||||
for (Element li : doc.select(".myui-vodlist__box")) { |
||||
String vid = li.select("a").attr("href"); |
||||
String name = li.select("a").attr("title"); |
||||
String pic = li.select("a").attr("data-original"); |
||||
if (!pic.startsWith("http")) pic = siteUrl + pic; |
||||
String remark = li.select(".pic-text.text-right").text(); |
||||
String year = li.select(".tag").text(); |
||||
list.add(new Vod(vid, name, pic, remark, year)); |
||||
} |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
String detailUrl = siteUrl + ids.get(0); |
||||
Document doc = Jsoup.parse(OkHttp.string(detailUrl, getHeader())); |
||||
Elements sources = doc.select(".myui-content__list.sort-list"); |
||||
Elements circuits = doc.select("a[href^=#playlist]"); |
||||
|
||||
StringBuilder vod_play_url = new StringBuilder(); |
||||
StringBuilder vod_play_from = new StringBuilder(); |
||||
for (int i = 0; i < circuits.size(); i++) { |
||||
String spanText = circuits.get(i).text(); |
||||
vod_play_from.append(spanText).append("$$$"); |
||||
Elements aElementArray = sources.get(i).select("a"); |
||||
for (int j = 0; j < aElementArray.size(); j++) { |
||||
Element a = aElementArray.get(j); |
||||
String href = a.attr("href"); |
||||
String text = a.text(); |
||||
vod_play_url.append(text).append("$").append(href); |
||||
boolean notLastEpisode = j < aElementArray.size() - 1; |
||||
vod_play_url.append(notLastEpisode ? "#" : "$$$"); |
||||
} |
||||
} |
||||
String text = doc.select(".myui-content__detail").text(); |
||||
String classifyName = Util.Matcher(text, "类型:(.*?)分类"); |
||||
String area = Util.Matcher(text, "地区:(.*?)年份"); |
||||
String year = Util.Matcher(text, "年份:(.*?)更新"); |
||||
String remark = Util.Matcher(text, "更新:(.*?)简介"); |
||||
String brief = doc.select(".col-pd.text-collapse .data").text(); |
||||
|
||||
Vod vod = new Vod(); |
||||
vod.setVodId(ids.get(0)); |
||||
vod.setVodArea(area); |
||||
vod.setVodYear(year); |
||||
vod.setVodRemarks(remark); |
||||
vod.setVodContent(brief); |
||||
vod.setTypeName(classifyName); |
||||
vod.setVodPlayFrom(vod_play_from.toString()); |
||||
vod.setVodPlayUrl(vod_play_url.toString()); |
||||
return Result.string(vod); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) throws Exception { |
||||
String searchUrl = siteUrl + "/search/" + Uri.encode(key) + "-------------.html"; |
||||
Document doc = Jsoup.parse(OkHttp.string(searchUrl, getHeader())); |
||||
List<Vod> list = new ArrayList<>(); |
||||
for (Element li : doc.select("li.clearfix")) { |
||||
String vid = li.select("a").attr("href"); |
||||
String name = li.select("a").attr("title"); |
||||
String pic = li.select("a").attr("data-original"); |
||||
if (!pic.startsWith("http")) pic = siteUrl + pic; |
||||
String remark = li.select(".pic-text.text-right").text(); |
||||
String year = li.select(".tag").text(); |
||||
list.add(new Vod(vid, name, pic, remark, year)); |
||||
} |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { |
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); |
||||
String todayDate = dateFormat.format(new Date()); |
||||
String ConfigUrl = siteUrl + "/static/js/playerconfig.js?t=" + todayDate; |
||||
if (!configCache.containsKey(ConfigUrl)) { |
||||
String ConfigContent = OkHttp.string(ConfigUrl, getHeader()); |
||||
String ConfigObject = Util.Matcher(ConfigContent, "player_list=(.*?),MacPlayerConfig"); |
||||
configCache.put(ConfigUrl, ConfigObject); |
||||
} |
||||
String content = OkHttp.string(siteUrl + id, getHeader()); |
||||
String json = Util.Matcher(content, "player_aaaa=(.*?)</script>"); |
||||
JSONObject player = new JSONObject(json); |
||||
String aaaaUrl = player.getString("url"); |
||||
String from = player.getString("from"); |
||||
String parseUrl = new JSONObject(configCache.get(ConfigUrl)).getJSONObject(from).getString("parse"); |
||||
String parseUrls = parseUrl + aaaaUrl; |
||||
String content1 = OkHttp.string(parseUrls, getHeader()); |
||||
String playUrl = Util.Matcher(content1, "getVideoInfo\\(\"(.*?)\""); |
||||
String key = "57A891D97E332A9D"; |
||||
String iv = Util.Matcher(content1, "bt_token = \"(.*?)\""); |
||||
String realUrl = Crypto.CBC(playUrl, key, iv); |
||||
if (realUrl == null) return Result.get().url(siteUrl + id).parse().string(); |
||||
return Result.get().url(realUrl).string(); |
||||
} |
||||
} |
||||
Binary file not shown.
@ -1 +1 @@ |
||||
101bd3f495cfb4cb4b3603d85d1647ea |
||||
2553b85b2f281ce4a4cbbc8d105cc7fd |
||||
|
||||
Loading…
Reference in new issue