parent
258bb9bdc7
commit
2fd1ffc00f
@ -0,0 +1,81 @@ |
||||
package com.github.catvod.bean.yiso; |
||||
|
||||
import com.github.catvod.bean.Vod; |
||||
import com.google.gson.Gson; |
||||
import com.google.gson.annotations.SerializedName; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
public class Item { |
||||
|
||||
@SerializedName("data") |
||||
private DataDTO data; |
||||
|
||||
public static Item objectFrom(String str) { |
||||
try { |
||||
return new Gson().fromJson(str, Item.class); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return new Item(); |
||||
} |
||||
} |
||||
|
||||
public DataDTO getData() { |
||||
return data == null ? new DataDTO() : data; |
||||
} |
||||
|
||||
public static class DataDTO { |
||||
|
||||
@SerializedName("list") |
||||
private List<ListDTO> list; |
||||
|
||||
public List<Vod> getList() { |
||||
List<Vod> items = new ArrayList<>(); |
||||
list = list == null ? Collections.emptyList() : list; |
||||
for (ListDTO item : list) items.add(item.getVod()); |
||||
return items; |
||||
} |
||||
|
||||
public static class ListDTO { |
||||
|
||||
@SerializedName("url") |
||||
private String url; |
||||
@SerializedName("gmtCreate") |
||||
private String gmtCreate; |
||||
@SerializedName("fileInfos") |
||||
private List<FileInfoDTO> fileInfos; |
||||
|
||||
public String getUrl() { |
||||
return url; |
||||
} |
||||
|
||||
public String getGmtCreate() { |
||||
return gmtCreate; |
||||
} |
||||
|
||||
public List<FileInfoDTO> getFileInfos() { |
||||
return fileInfos; |
||||
} |
||||
|
||||
public Vod getVod() { |
||||
String id = getUrl(); |
||||
String name = getFileInfos().get(0).getFileName(); |
||||
String remark = getGmtCreate(); |
||||
String pic = "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000"; |
||||
return new Vod(id, name, pic, remark); |
||||
} |
||||
|
||||
public static class FileInfoDTO { |
||||
|
||||
@SerializedName("fileName") |
||||
private String fileName; |
||||
|
||||
public String getFileName() { |
||||
return fileName; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,285 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.text.TextUtils; |
||||
|
||||
import com.github.catvod.bean.Result; |
||||
import com.github.catvod.bean.Vod; |
||||
import com.github.catvod.net.OkHttpUtil; |
||||
import com.github.catvod.utils.Misc; |
||||
|
||||
import org.json.JSONArray; |
||||
import org.json.JSONException; |
||||
import org.json.JSONObject; |
||||
|
||||
import java.io.ByteArrayInputStream; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Objects; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
/** |
||||
* @author ColaMint & Adam & FongMi |
||||
*/ |
||||
public class Ali { |
||||
|
||||
private final Pattern pattern = Pattern.compile("www.aliyundrive.com/s/([^/]+)(/folder/([^/]+))?"); |
||||
private static String accessToken; |
||||
private String refreshToken; |
||||
|
||||
public Ali(String token) { |
||||
checkToken(token); |
||||
} |
||||
|
||||
private void checkToken(String token) { |
||||
if (TextUtils.isEmpty(token)) Init.show("尚未設定阿里Token"); |
||||
refreshToken = token; |
||||
} |
||||
|
||||
private static HashMap<String, String> getHeaders() { |
||||
HashMap<String, String> headers = new HashMap<>(); |
||||
headers.put("User-Agent", Misc.CHROME); |
||||
headers.put("Referer", "https://www.aliyundrive.com/"); |
||||
return headers; |
||||
} |
||||
|
||||
private static HashMap<String, String> getHeaders(String shareToken) { |
||||
HashMap<String, String> headers = getHeaders(); |
||||
if (accessToken != null) headers.put("authorization", accessToken); |
||||
headers.put("x-share-token", shareToken); |
||||
return headers; |
||||
} |
||||
|
||||
private String post(String url, JSONObject body) { |
||||
return OkHttpUtil.postJson("https://api.aliyundrive.com/" + url, body.toString(), getHeaders()); |
||||
} |
||||
|
||||
private static String post(String url, JSONObject body, String shareToken) { |
||||
return OkHttpUtil.postJson("https://api.aliyundrive.com/" + url, body.toString(), getHeaders(shareToken)); |
||||
} |
||||
|
||||
public String detailContent(List<String> ids) throws Exception { |
||||
String url = ids.get(0).trim(); |
||||
Matcher matcher = pattern.matcher(url); |
||||
if (matcher.find()) return Result.string(getVod(matcher, url)); |
||||
return ""; |
||||
} |
||||
|
||||
public String playerContent(String flag, String id) { |
||||
String[] ids = id.split("\\+"); |
||||
String shareId = ids[0]; |
||||
String shareToken = ids[1]; |
||||
String fileId = ids[2]; |
||||
String sub = getSub(shareId, shareToken, ids); |
||||
refreshAccessToken(); |
||||
if (TextUtils.isEmpty(accessToken)) return ""; |
||||
if (flag.contains("原畫")) { |
||||
return Result.get().url(getDownloadUrl(shareId, shareToken, fileId)).sub(sub).header(getHeaders()).string(); |
||||
} else { |
||||
return Result.get().url(getPreviewUrl(shareId, shareToken, fileId)).sub(sub).header(getHeaders()).string(); |
||||
} |
||||
} |
||||
|
||||
private Vod getVod(Matcher matcher, String url) throws Exception { |
||||
String shareId = matcher.group(1); |
||||
String shareToken = getShareToken(shareId); |
||||
String fileId = matcher.groupCount() == 3 ? matcher.group(3) : ""; |
||||
JSONObject body = new JSONObject(); |
||||
body.put("share_id", shareId); |
||||
String json = post("adrive/v3/share_link/get_share_by_anonymous", body); |
||||
JSONObject object = new JSONObject(json); |
||||
Map<String, String> name2id = new HashMap<>(); |
||||
Map<String, List<String>> subMap = new HashMap<>(); |
||||
listFiles(0, name2id, subMap, shareId, shareToken, getParentFileId(fileId, object)); |
||||
List<String> playUrls = new ArrayList<>(); |
||||
List<String> names = new ArrayList<>(name2id.keySet()); |
||||
Collections.sort(names); |
||||
for (String name : names) playUrls.add(name + "$" + name2id.get(name) + findSubs(name, subMap)); |
||||
List<String> sourceUrls = new ArrayList<>(); |
||||
sourceUrls.add(TextUtils.join("#", playUrls)); |
||||
sourceUrls.add(TextUtils.join("#", playUrls)); |
||||
Vod vod = new Vod(); |
||||
vod.setVodId(url); |
||||
vod.setVodContent(url); |
||||
vod.setVodPic(object.getString("avatar")); |
||||
vod.setVodName(object.getString("share_name")); |
||||
vod.setVodPlayUrl(TextUtils.join("$$$", sourceUrls)); |
||||
vod.setVodPlayFrom("AliYun$$$AliYun原畫"); |
||||
vod.setTypeName("阿里雲盤"); |
||||
return vod; |
||||
} |
||||
|
||||
private void listFiles(int level, Map<String, String> name2id, Map<String, List<String>> subMap, String shareId, String shareToken, String parentFileId) throws Exception { |
||||
JSONObject body = new JSONObject(); |
||||
body.put("marker", ""); |
||||
body.put("limit", 200); |
||||
body.put("share_id", shareId); |
||||
body.put("parent_file_id", parentFileId); |
||||
body.put("order_by", "updated_at"); |
||||
body.put("order_direction", "DESC"); |
||||
body.put("image_url_process", "image/resize,w_1920/format,jpeg"); |
||||
body.put("image_thumbnail_process", "image/resize,w_160/format,jpeg"); |
||||
body.put("video_thumbnail_process", "video/snapshot,t_1000,f_jpg,ar_auto,w_300"); |
||||
String json = post("adrive/v3/file/list", body, shareToken); |
||||
JSONArray items = new JSONObject(json).getJSONArray("items"); |
||||
List<String> folders = new ArrayList<>(); |
||||
for (int j = 0; j < items.length(); ++j) { |
||||
JSONObject item = items.getJSONObject(j); |
||||
String type = item.optString("type"); |
||||
String name = item.optString("name"); |
||||
String fileId = item.optString("file_id"); |
||||
String category = item.optString("category", ""); |
||||
String ext = item.optString("file_extension", ""); |
||||
if (type.equals("folder")) { |
||||
folders.add(fileId); |
||||
continue; |
||||
} |
||||
if (category.equals("video")) { |
||||
name2id.put(name, shareId + "+" + shareToken + "+" + fileId); |
||||
continue; |
||||
} |
||||
if (isSubFile(ext)) { |
||||
name = name.replace("." + ext, ""); |
||||
if (!subMap.containsKey(name)) subMap.put(name, new ArrayList<>()); |
||||
Objects.requireNonNull(subMap.get(name)).add(name + "@" + fileId + "@" + ext); |
||||
} |
||||
} |
||||
for (String folder : folders) { |
||||
if (level == 2) break; |
||||
listFiles(++level, name2id, subMap, shareId, shareToken, folder); |
||||
} |
||||
} |
||||
|
||||
private String getParentFileId(String fileId, JSONObject shareInfo) throws Exception { |
||||
JSONArray array = shareInfo.getJSONArray("file_infos"); |
||||
if (!TextUtils.isEmpty(fileId)) return fileId; |
||||
if (array.length() == 0) return ""; |
||||
JSONObject fileInfo = array.getJSONObject(0); |
||||
if (fileInfo.getString("type").equals("folder")) return fileInfo.getString("file_id"); |
||||
if (fileInfo.getString("type").equals("file") && fileInfo.getString("category").equals("video")) return "root"; |
||||
return ""; |
||||
} |
||||
|
||||
private void refreshAccessToken() { |
||||
try { |
||||
JSONObject body = new JSONObject(); |
||||
body.put("refresh_token", refreshToken); |
||||
JSONObject object = new JSONObject(post("token/refresh", body)); |
||||
accessToken = object.getString("token_type") + " " + object.getString("access_token"); |
||||
} catch (JSONException e) { |
||||
Init.show("阿里Token已失效"); |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
private String findSubs(String name, Map<String, List<String>> subMap) { |
||||
name = name.substring(0, name.lastIndexOf(".")); |
||||
List<String> subs = subMap.get(name); |
||||
if (subs != null && subs.size() > 0) return combineSubs(subs); |
||||
for (Map.Entry<String, List<String>> entry : subMap.entrySet()) if (entry.getKey().contains(name)) return combineSubs(entry.getValue()); |
||||
return ""; |
||||
} |
||||
|
||||
private String combineSubs(List<String> subs) { |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (String sub : subs) sb.append("+").append(sub); |
||||
return sb.toString(); |
||||
} |
||||
|
||||
private String getSub(String shareId, String shareToken, String[] ids) { |
||||
StringBuilder sb = new StringBuilder(); |
||||
for (String text : ids) { |
||||
if (!text.contains("@")) continue; |
||||
String[] arr = text.split("@"); |
||||
String url = Proxy.getUrl() + "?do=ali&type=sub&share_id=" + shareId + "&share_token=" + shareToken + "&file_id=" + arr[1]; |
||||
sb.append(arr[0]).append("#").append(getSubMimeType(arr[2])).append("#").append(url).append("$$$"); |
||||
return Misc.substring(sb.toString(), 3); |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
private boolean isSubFile(String ext) { |
||||
return ext.equals("srt") || ext.equals("ass") || ext.equals("ssa"); |
||||
} |
||||
|
||||
private String getSubMimeType(String type) { |
||||
if (type.equals("srt")) return "application/x-subrip"; |
||||
if (type.equals("ass") || type.equals("ssa")) return "text/x-ssa"; |
||||
return "application/x-subrip"; |
||||
} |
||||
|
||||
private String getShareToken(String shareId) { |
||||
try { |
||||
JSONObject body = new JSONObject(); |
||||
body.put("share_id", shareId); |
||||
body.put("share_pwd", ""); |
||||
String json = post("v2/share_link/get_share_token", body); |
||||
return new JSONObject(json).getString("share_token"); |
||||
} catch (JSONException e) { |
||||
e.printStackTrace(); |
||||
return ""; |
||||
} |
||||
} |
||||
|
||||
private String getPreviewQuality(JSONArray taskList) throws Exception { |
||||
for (String templateId : Arrays.asList("UHD", "QHD", "FHD", "HD", "SD", "LD")) { |
||||
for (int i = 0; i < taskList.length(); ++i) { |
||||
JSONObject task = taskList.getJSONObject(i); |
||||
if (task.getString("template_id").equals(templateId)) { |
||||
return task.getString("url"); |
||||
} |
||||
} |
||||
} |
||||
return taskList.getJSONObject(0).getString("url"); |
||||
} |
||||
|
||||
private String getPreviewUrl(String shareId, String shareToken, String fileId) { |
||||
try { |
||||
JSONObject body = new JSONObject(); |
||||
body.put("file_id", fileId); |
||||
body.put("share_id", shareId); |
||||
body.put("template_id", ""); |
||||
body.put("category", "live_transcoding"); |
||||
String json = post("v2/file/get_share_link_video_preview_play_info", body, shareToken); |
||||
JSONArray taskList = new JSONObject(json).getJSONObject("video_preview_play_info").getJSONArray("live_transcoding_task_list"); |
||||
Map<String, List<String>> respHeaders = new HashMap<>(); |
||||
OkHttpUtil.stringNoRedirect(getPreviewQuality(taskList), getHeaders(), respHeaders); |
||||
return respHeaders.get("location").get(0); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return ""; |
||||
} |
||||
} |
||||
|
||||
private static String getDownloadUrl(String shareId, String shareToken, String fileId) { |
||||
try { |
||||
JSONObject body = new JSONObject(); |
||||
body.put("file_id", fileId); |
||||
body.put("share_id", shareId); |
||||
String json = post("v2/file/get_share_link_download_url", body, shareToken); |
||||
String url = new JSONObject(json).optString("download_url"); |
||||
Map<String, List<String>> respHeaders = new HashMap<>(); |
||||
OkHttpUtil.stringNoRedirect(url, getHeaders(), respHeaders); |
||||
return respHeaders.get("location").get(0); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return ""; |
||||
} |
||||
} |
||||
|
||||
public static Object[] vod(Map<String, String> params) { |
||||
String shareId = params.get("share_id"); |
||||
String shareToken = params.get("share_token"); |
||||
String fileId = params.get("file_id"); |
||||
String text = OkHttpUtil.string(getDownloadUrl(shareId, shareToken, fileId), getHeaders(shareToken)); |
||||
Object[] result = new Object[3]; |
||||
result[0] = 200; |
||||
result[1] = "application/octet-stream"; |
||||
result[2] = new ByteArrayInputStream(text.getBytes()); |
||||
return result; |
||||
} |
||||
} |
||||
@ -0,0 +1,77 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.content.Context; |
||||
|
||||
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 org.jsoup.Jsoup; |
||||
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.List; |
||||
import java.util.Map; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
/** |
||||
* @author ColaMint & FongMi |
||||
*/ |
||||
public class PanSou extends Spider { |
||||
|
||||
private final Pattern regexAliUrl = Pattern.compile("(https:\\/\\/www.aliyundrive.com\\/s\\/[^\\\"]+)"); |
||||
private final String siteUrl = "https://www.alipansou.com"; |
||||
private Ali ali; |
||||
|
||||
@Override |
||||
public void init(Context context, String extend) { |
||||
ali = new Ali(extend); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
String url = ids.get(0); |
||||
Matcher matcher = regexAliUrl.matcher(url); |
||||
if (matcher.find()) return ali.detailContent(ids); |
||||
url = siteUrl + ids.get(0); |
||||
String html = OkHttpUtil.string(url); |
||||
matcher = regexAliUrl.matcher(html); |
||||
if (!matcher.find()) return ""; |
||||
ids.set(0, matcher.group(1).replace("\\/", "/")); |
||||
return ali.detailContent(ids); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) { |
||||
Map<String, String> types = new HashMap<>(); |
||||
types.put("7", "資料夾"); |
||||
types.put("1", "影片"); |
||||
List<Vod> list = new ArrayList<>(); |
||||
for (Map.Entry<String, String> entry : types.entrySet()) { |
||||
String typeId = entry.getKey(); |
||||
String typeName = entry.getValue(); |
||||
String url = siteUrl + "/search?k=" + URLEncoder.encode(key) + "&t=" + typeId; |
||||
Elements items = Jsoup.parse(OkHttpUtil.string(url)).select("van-row > a"); |
||||
for (Element item : items) { |
||||
String title = item.selectFirst("template").text().trim(); |
||||
if (!title.contains(key)) continue; |
||||
Vod vod = new Vod(); |
||||
vod.setVodId(item.attr("href")); |
||||
vod.setVodName("[" + typeName + "] " + title); |
||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000"); |
||||
list.add(vod); |
||||
} |
||||
} |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> vipFlags) { |
||||
return ali.playerContent(flag, id); |
||||
} |
||||
} |
||||
@ -0,0 +1,106 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.content.Context; |
||||
|
||||
import com.github.catvod.bean.Class; |
||||
import com.github.catvod.bean.Filter; |
||||
import com.github.catvod.bean.Result; |
||||
import com.github.catvod.bean.Vod; |
||||
import com.github.catvod.bean.paper.Data; |
||||
import com.github.catvod.bean.paper.Item; |
||||
import com.github.catvod.crawler.Spider; |
||||
import com.github.catvod.net.OkHttpUtil; |
||||
import com.github.catvod.utils.Misc; |
||||
|
||||
import org.json.JSONException; |
||||
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.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.HashMap; |
||||
import java.util.LinkedHashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ColaMint & FongMi |
||||
*/ |
||||
public class Paper extends Spider { |
||||
|
||||
private List<String> types; |
||||
private List<Data> all; |
||||
private Ali ali; |
||||
|
||||
private HashMap<String, String> getHeaders() { |
||||
HashMap<String, String> headers = new HashMap<>(); |
||||
headers.put("User-Agent", Misc.CHROME); |
||||
return headers; |
||||
} |
||||
|
||||
private List<Data> getAll() { |
||||
return all = all != null ? all : Item.objectFrom(OkHttpUtil.string("https://gitcafe.net/alipaper/all.json", getHeaders())).getData(); |
||||
} |
||||
|
||||
@Override |
||||
public void init(Context context, String extend) { |
||||
types = new ArrayList<>(); |
||||
ali = new Ali(extend); |
||||
} |
||||
|
||||
@Override |
||||
public String homeContent(boolean filter) throws JSONException { |
||||
Document doc = Jsoup.parse(OkHttpUtil.string("https://u.gitcafe.net/", getHeaders())); |
||||
Elements trs = doc.select("table.tableizer-table > tbody > tr"); |
||||
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>(); |
||||
List<Class> classes = new ArrayList<>(); |
||||
for (Element tr : trs) { |
||||
if (tr.text().contains("音乐")) break; |
||||
List<Filter.Value> values = new ArrayList<>(); |
||||
for (Element td : tr.select("td")) { |
||||
if (td.hasClass("tableizer-title")) { |
||||
String typeId = td.select("a").attr("href").replace("#", ""); |
||||
classes.add(new Class(typeId, td.text())); |
||||
filters.put(typeId, Arrays.asList(new Filter("type", "類型", values))); |
||||
} else { |
||||
String value = td.select("a").attr("onclick").split("'")[1]; |
||||
values.add(new Filter.Value(td.text(), value)); |
||||
types.add(value); |
||||
} |
||||
} |
||||
} |
||||
List<Vod> list = new ArrayList<>(); |
||||
JSONObject homeData = new JSONObject(OkHttpUtil.string("https://gitcafe.net/alipaper/home.json", getHeaders())); |
||||
List<Data> items = Data.arrayFrom(homeData.getJSONObject("info").getJSONArray("new").toString()); |
||||
for (Data item : items) if (types.contains(item.getCat())) list.add(item.getVod()); |
||||
return Result.string(classes, list, filters); |
||||
} |
||||
|
||||
@Override |
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) { |
||||
List<Vod> list = new ArrayList<>(); |
||||
String type = extend.containsKey("type") ? extend.get("type") : tid; |
||||
List<Data> items = Data.arrayFrom(OkHttpUtil.string("https://gitcafe.net/alipaper/data/" + type + ".json", getHeaders())); |
||||
for (Data item : items) list.add(item.getVod()); |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
return ali.detailContent(ids); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) { |
||||
List<Vod> list = new ArrayList<>(); |
||||
for (Data item : getAll()) if (types.contains(item.getCat()) && item.getTitle().contains(key)) list.add(item.getVod()); |
||||
return Result.string(list); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { |
||||
return ali.playerContent(flag, id); |
||||
} |
||||
} |
||||
@ -0,0 +1,59 @@ |
||||
package com.github.catvod.spider; |
||||
|
||||
import android.content.Context; |
||||
import android.os.SystemClock; |
||||
import android.webkit.WebView; |
||||
import android.webkit.WebViewClient; |
||||
|
||||
import com.github.catvod.bean.Result; |
||||
import com.github.catvod.bean.yiso.Item; |
||||
import com.github.catvod.crawler.Spider; |
||||
import com.github.catvod.utils.Misc; |
||||
import com.google.gson.JsonParser; |
||||
|
||||
import java.net.URLEncoder; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Objects; |
||||
|
||||
public class YiSo extends Spider { |
||||
|
||||
private Ali ali; |
||||
|
||||
@Override |
||||
public void init(Context context, String extend) { |
||||
ali = new Ali(extend); |
||||
} |
||||
|
||||
@Override |
||||
public String detailContent(List<String> ids) throws Exception { |
||||
return ali.detailContent(ids); |
||||
} |
||||
|
||||
@Override |
||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { |
||||
return ali.playerContent(flag, id); |
||||
} |
||||
|
||||
@Override |
||||
public String searchContent(String key, boolean quick) { |
||||
String url = "https://yiso.fun/api/search?name=" + URLEncoder.encode(key) + "&from=ali"; |
||||
Map<String, String> result = new HashMap<>(); |
||||
Misc.loadWebView(url, getWebViewClient(result)); |
||||
while (!result.containsKey("json")) SystemClock.sleep(250); |
||||
String json = JsonParser.parseString(Objects.requireNonNull(result.get("json"))).getAsJsonPrimitive().getAsString(); |
||||
return Result.string(Item.objectFrom(json).getData().getList()); |
||||
} |
||||
|
||||
private WebViewClient getWebViewClient(Map<String, String> result) { |
||||
return new WebViewClient() { |
||||
@Override |
||||
public void onPageFinished(WebView view, String url) { |
||||
view.evaluateJavascript("document.getElementsByTagName('pre')[0].textContent", value -> { |
||||
if (!value.equals("null")) result.put("json", value); |
||||
}); |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
Binary file not shown.
@ -1 +1 @@ |
||||
19211bffdfc96677d1eee804ff300a47 |
||||
f913d30766882408e79b7316771dd011 |
||||
|
||||
Loading…
Reference in new issue