Clean code
This commit is contained in:
parent
8f8f0fcba1
commit
006a785b1c
|
|
@ -1,85 +0,0 @@
|
||||||
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(String key) {
|
|
||||||
List<Vod> items = new ArrayList<>();
|
|
||||||
list = list == null ? Collections.emptyList() : list;
|
|
||||||
for (ListDTO item : list) if (item.getName().contains(key)) 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 String getName() {
|
|
||||||
return getFileInfos().get(0).getFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vod getVod() {
|
|
||||||
String id = getUrl();
|
|
||||||
String name = getName();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
package com.github.catvod.spider;
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.github.catvod.bean.Result;
|
import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
import com.github.catvod.bean.Vod;
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
@ -20,47 +18,42 @@ import javax.crypto.spec.IvParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
public class YiSo extends Ali {
|
public class YiSo extends Ali {
|
||||||
@Override
|
|
||||||
public void init(Context context, String extend) {
|
private HashMap<String, String> getHeaders() {
|
||||||
super.init(context, extend);
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36");
|
||||||
|
headers.put("Referer", "https://yiso.fun/");
|
||||||
|
headers.put("Cookie", "satoken=2854cb58-3884-473b-84c4-34161f67a409");
|
||||||
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String searchContent(String key, boolean quick) throws Exception {
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
HashMap<String, String> hashMap = new HashMap<>();
|
String json = OkHttp.string("https://yiso.fun/api/search?name=" + URLEncoder.encode(key) + "&pageNo=1&from=ali", getHeaders());
|
||||||
hashMap.put("User-Agent", "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36");
|
JSONArray array = new JSONObject(json).getJSONObject("data").getJSONArray("list");
|
||||||
hashMap.put("Referer", "https://yiso.fun/");
|
ArrayList<Vod> list = new ArrayList<>();
|
||||||
hashMap.put("Cookie", "satoken=2854cb58-3884-473b-84c4-34161f67a409");
|
for (int i = 0; i < array.length(); i++) {
|
||||||
String poststr = OkHttp.string("https://yiso.fun/api/search?name=" + URLEncoder.encode(key) + "&pageNo=1&from=ali", hashMap);
|
|
||||||
SpiderDebug.log(poststr);
|
|
||||||
JSONArray jsonArray = new JSONObject(poststr).getJSONObject("data").getJSONArray("list");
|
|
||||||
ArrayList<Vod> arrayList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
String string = jsonArray.getJSONObject(i).getJSONArray("fileInfos").getJSONObject(0).getString("fileName");
|
String name = array.getJSONObject(i).getJSONArray("fileInfos").getJSONObject(0).getString("fileName");
|
||||||
String string2 = jsonArray.getJSONObject(i).getString("gmtCreate");
|
String remark = array.getJSONObject(i).getString("gmtCreate");
|
||||||
vod.setVodId(decrypt(jsonArray.getJSONObject(i).getString("url")));
|
vod.setVodId(decrypt(array.getJSONObject(i).getString("url")));
|
||||||
vod.setVodName(string);
|
vod.setVodName(name);
|
||||||
|
vod.setVodRemarks(remark);
|
||||||
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
|
||||||
vod.setVodRemarks(string2);
|
list.add(vod);
|
||||||
arrayList.add(vod);
|
|
||||||
}
|
}
|
||||||
|
return Result.string(list);
|
||||||
return Result.string(arrayList);
|
|
||||||
// return ("55555555555555");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String decrypt(String str) {
|
public String decrypt(String str) {
|
||||||
try {
|
try {
|
||||||
SecretKeySpec secretKeySpec = new SecretKeySpec("4OToScUFOaeVTrHE".getBytes("UTF-8"), "AES");
|
SecretKeySpec key = new SecretKeySpec("4OToScUFOaeVTrHE".getBytes("UTF-8"), "AES");
|
||||||
IvParameterSpec ivParameterSpec = new IvParameterSpec("9CLGao1vHKqm17Oz".getBytes("UTF-8"));
|
IvParameterSpec iv = new IvParameterSpec("9CLGao1vHKqm17Oz".getBytes("UTF-8"));
|
||||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
cipher.init(2, secretKeySpec, ivParameterSpec);
|
cipher.init(Cipher.DECRYPT_MODE, key, iv);
|
||||||
return new String(cipher.doFinal(Base64.decode(str.getBytes(), 0)), "UTF-8");
|
return new String(cipher.doFinal(Base64.decode(str.getBytes(), 0)), "UTF-8");
|
||||||
} catch (Exception unused) {
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
a0fb5dc6e2d2199a6663c3d5cee4bedb
|
0cd8dd32e89511058fd8e6bceb586a28
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue