Clean code
This commit is contained in:
parent
b2cc0c5889
commit
e2a7770e85
|
|
@ -211,6 +211,6 @@ public class Result {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new Gson().toJson(this);
|
||||
return new Gson().newBuilder().disableHtmlEscaping().create().toJson(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,21 +6,22 @@ import com.github.catvod.bean.Vod;
|
|||
import com.github.catvod.utils.Utils;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Data {
|
||||
|
||||
@SerializedName(value = "jump_id", alternate = "id")
|
||||
private String vodId;
|
||||
private String jumpId;
|
||||
@SerializedName(value = "thumbnail", alternate = "path")
|
||||
private String vodPic;
|
||||
@SerializedName(value = "title")
|
||||
private String vodName;
|
||||
@SerializedName(value = "mask")
|
||||
private String vodRemark;
|
||||
private String thumbnail;
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
@SerializedName("mask")
|
||||
private String mask;
|
||||
@SerializedName("description")
|
||||
private String description;
|
||||
@SerializedName(value = "playlist")
|
||||
@SerializedName("playlist")
|
||||
private Value playlist;
|
||||
@SerializedName("year")
|
||||
private Value year;
|
||||
|
|
@ -35,20 +36,20 @@ public class Data {
|
|||
@SerializedName("btbo_downlist")
|
||||
private List<BtboDown> btboDownlist;
|
||||
|
||||
public String getVodId() {
|
||||
return TextUtils.isEmpty(vodId) ? "" : vodId;
|
||||
public String getJumpId() {
|
||||
return TextUtils.isEmpty(jumpId) ? "" : jumpId;
|
||||
}
|
||||
|
||||
public String getVodPic() {
|
||||
return TextUtils.isEmpty(vodPic) ? "" : vodPic + "@Referer=www.jianpianapp.com@User-Agent=jianpian-version362";
|
||||
public String getThumbnail() {
|
||||
return TextUtils.isEmpty(thumbnail) ? "" : thumbnail + "@Referer=www.jianpianapp.com@User-Agent=jianpian-version362";
|
||||
}
|
||||
|
||||
public String getVodName() {
|
||||
return TextUtils.isEmpty(vodName) ? "" : vodName;
|
||||
public String getTitle() {
|
||||
return TextUtils.isEmpty(title) ? "" : title;
|
||||
}
|
||||
|
||||
public String getVodRemark() {
|
||||
return TextUtils.isEmpty(vodRemark) ? getPlaylist() : vodRemark;
|
||||
public String getMask() {
|
||||
return TextUtils.isEmpty(mask) ? getPlaylist() : mask;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
@ -68,35 +69,35 @@ public class Data {
|
|||
}
|
||||
|
||||
public String getTypes() {
|
||||
if (types == null) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Value value : types) sb.append(value.getTitle()).append(" ");
|
||||
return Utils.substring(sb.toString());
|
||||
return types == null ? "" : getValues(types);
|
||||
}
|
||||
|
||||
public String getActors() {
|
||||
if (actors == null) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Value value : actors) sb.append(value.getLink()).append(" ");
|
||||
return Utils.substring(sb.toString());
|
||||
return actors == null ? "" : getValues(actors);
|
||||
}
|
||||
|
||||
public String getDirectors() {
|
||||
if (directors == null) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Value value : directors) sb.append(value.getLink()).append(" ");
|
||||
return Utils.substring(sb.toString());
|
||||
return directors == null ? "" : getValues(directors);
|
||||
}
|
||||
|
||||
public String getBtboDownlist() {
|
||||
if (btboDownlist == null) return "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (BtboDown value : btboDownlist) sb.append(value.getVal()).append("#");
|
||||
return Utils.substring(sb.toString());
|
||||
public List<BtboDown> getBtboDownlist() {
|
||||
return btboDownlist == null ? Collections.emptyList() : btboDownlist;
|
||||
}
|
||||
|
||||
public Vod vod() {
|
||||
return new Vod(getVodId(), getVodName(), getVodPic(), getVodRemark());
|
||||
return new Vod(getJumpId(), getTitle(), getThumbnail(), getMask());
|
||||
}
|
||||
|
||||
public String getPlayUrl() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (BtboDown value : getBtboDownlist()) sb.append(value.getVal()).append("#");
|
||||
return Utils.substring(sb.toString());
|
||||
}
|
||||
|
||||
public String getValues(List<Value> items) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Value value : items) sb.append(value.getLink()).append(" ");
|
||||
return Utils.substring(sb.toString());
|
||||
}
|
||||
|
||||
public static class Value {
|
||||
|
|
@ -109,7 +110,7 @@ public class Data {
|
|||
}
|
||||
|
||||
public String getLink() {
|
||||
return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}]%s[/a]", getTitle() + "/{pg}", getTitle(), getTitle());
|
||||
return String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", getTitle() + "/{pg}", getTitle(), getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,16 +59,21 @@ public class Jianpian extends Spider {
|
|||
|
||||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
HashMap<String, String> ext = new HashMap<>();
|
||||
if (extend != null && extend.size() > 0) ext.putAll(extend);
|
||||
String cateId = ext.get("cateId") == null ? tid : ext.get("cateId");
|
||||
String year = ext.get("year") == null ? "0" : ext.get("year");
|
||||
String by = ext.get("by") == null ? "hot" : ext.get("by");
|
||||
String url = siteUrl + String.format("/api/crumb/list?area=0&category_id=%s&page=%s&type=0&limit=24&sort=%s&year=%s", cateId, pg, by, year);
|
||||
Resp resp = Resp.objectFrom(OkHttp.string(url, getHeader()));
|
||||
for (Data data : resp.getData()) list.add(data.vod());
|
||||
return Result.string(list);
|
||||
if (tid.endsWith("/{pg}")) {
|
||||
String[] splits = tid.split("/");
|
||||
return searchContent(splits[0], pg);
|
||||
} else {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
HashMap<String, String> ext = new HashMap<>();
|
||||
if (extend != null && extend.size() > 0) ext.putAll(extend);
|
||||
String cateId = ext.get("cateId") == null ? tid : ext.get("cateId");
|
||||
String year = ext.get("year") == null ? "0" : ext.get("year");
|
||||
String by = ext.get("by") == null ? "hot" : ext.get("by");
|
||||
String url = siteUrl + String.format("/api/crumb/list?area=0&category_id=%s&page=%s&type=0&limit=24&sort=%s&year=%s", cateId, pg, by, year);
|
||||
Resp resp = Resp.objectFrom(OkHttp.string(url, getHeader()));
|
||||
for (Data data : resp.getData()) list.add(data.vod());
|
||||
return Result.string(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -76,14 +81,14 @@ public class Jianpian extends Spider {
|
|||
String url = siteUrl + "/api/node/detail?channel=wandoujia&token=&id=" + ids.get(0);
|
||||
Data data = Detail.objectFrom(OkHttp.string(url, getHeader())).getData();
|
||||
Vod vod = data.vod();
|
||||
vod.setVodPlayFrom("Jianpian");
|
||||
vod.setVodYear(data.getYear());
|
||||
vod.setVodArea(data.getArea());
|
||||
vod.setTypeName(data.getTypes());
|
||||
vod.setVodActor(data.getActors());
|
||||
vod.setVodPlayUrl(data.getPlayUrl());
|
||||
vod.setVodDirector(data.getDirectors());
|
||||
vod.setVodContent(data.getDescription());
|
||||
vod.setVodPlayUrl(data.getBtboDownlist());
|
||||
vod.setVodPlayFrom("荐片");
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
badfd75846df45e8cf06b53654312ccf
|
||||
3373bc113deec1bad88de323923dbe4f
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;badfd75846df45e8cf06b53654312ccf",
|
||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;3373bc113deec1bad88de323923dbe4f",
|
||||
"wallpaper": "https://gao.chuqiuyu.tk",
|
||||
"sites": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;badfd75846df45e8cf06b53654312ccf",
|
||||
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;3373bc113deec1bad88de323923dbe4f",
|
||||
"wallpaper": "http://饭太硬.top/深色壁纸/api.php",
|
||||
"sites": [
|
||||
{
|
||||
|
|
@ -31,12 +31,13 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"key": "荐片",
|
||||
"name": "荐片",
|
||||
"key": "賤賤",
|
||||
"name": "賤賤",
|
||||
"type": 3,
|
||||
"api": "csp_Jianpian",
|
||||
"searchable": 1,
|
||||
"changeable": 1
|
||||
"changeable": 1,
|
||||
"ext": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/json/jianpian.json"
|
||||
},
|
||||
{
|
||||
"key": "獨播",
|
||||
|
|
|
|||
Loading…
Reference in New Issue