Clean
This commit is contained in:
parent
a56912b23c
commit
a1324dfd13
|
|
@ -6,6 +6,7 @@ import com.github.catvod.bean.Vod;
|
|||
import com.github.catvod.utils.Util;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -36,9 +37,9 @@ public class Data {
|
|||
@SerializedName("directors")
|
||||
private List<Value> directors;
|
||||
@SerializedName("source_list_source")
|
||||
private List<SourceListSource> source_list_source;
|
||||
private List<SourceListSource> source;
|
||||
@SerializedName("dataList")
|
||||
private List<DataList> dataList;
|
||||
private List<Data> dataList;
|
||||
|
||||
public String getJumpId() {
|
||||
return TextUtils.isEmpty(jumpId) ? "" : jumpId;
|
||||
|
|
@ -88,11 +89,11 @@ public class Data {
|
|||
return directors == null ? "" : getValues(directors, true);
|
||||
}
|
||||
|
||||
public List<SourceListSource> getSourcelistsource() {
|
||||
return source_list_source == null ? Collections.emptyList() : source_list_source;
|
||||
public List<SourceListSource> getSource() {
|
||||
return source == null ? Collections.emptyList() : source;
|
||||
}
|
||||
|
||||
public List<DataList> getDataList() {
|
||||
public List<Data> getDataList() {
|
||||
return dataList == null ? Collections.emptyList() : dataList;
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +112,7 @@ public class Data {
|
|||
}
|
||||
|
||||
public static class Value {
|
||||
|
||||
@SerializedName(value = "title", alternate = "name")
|
||||
private String title;
|
||||
|
||||
|
|
@ -128,28 +130,30 @@ public class Data {
|
|||
}
|
||||
|
||||
public static class SourceListSource {
|
||||
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("source_list")
|
||||
private List<SourceList> source_list;
|
||||
private List<SourceList> list;
|
||||
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public List<SourceList> getSourcelist() {
|
||||
return source_list == null ? Collections.emptyList() : source_list;
|
||||
public List<SourceList> getList() {
|
||||
return list == null ? Collections.emptyList() : list;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SourceList {
|
||||
|
||||
@SerializedName("source_name")
|
||||
private String source_name;
|
||||
private String name;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
|
||||
public String getSource_name() {
|
||||
return TextUtils.isEmpty(source_name) ? "" : source_name;
|
||||
public String getName() {
|
||||
return TextUtils.isEmpty(name) ? "" : name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
|
|
@ -158,76 +162,18 @@ public class Data {
|
|||
}
|
||||
|
||||
public String getVodFrom() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
List<SourceListSource> sources = getSourcelistsource();
|
||||
|
||||
if (sources != null && !sources.isEmpty()) {
|
||||
for (int i = 0; i < sources.size(); i++) {
|
||||
if (i > 0) {
|
||||
result.append("$$$");
|
||||
}
|
||||
result.append(sources.get(i).getName());
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
List<String> items = new ArrayList<>();
|
||||
for (SourceListSource source : getSource()) items.add(source.getName());
|
||||
return TextUtils.join("$$$", items);
|
||||
}
|
||||
|
||||
public String getVodUrl() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
List<SourceListSource> sources = getSourcelistsource();
|
||||
|
||||
if (sources != null && !sources.isEmpty()) {
|
||||
for (SourceListSource source : sources) {
|
||||
List<SourceList> sourceLists = source.getSourcelist();
|
||||
if (sourceLists != null && !sourceLists.isEmpty()) {
|
||||
for (SourceList item : sourceLists) {
|
||||
result.append(item.getSource_name())
|
||||
.append("$")
|
||||
.append(item.getUrl())
|
||||
.append("#");
|
||||
}
|
||||
if (result.length() > 0) {
|
||||
result.deleteCharAt(result.length() - 1);
|
||||
}
|
||||
result.append("$$$");
|
||||
}
|
||||
}
|
||||
if (result.length() >= 3) {
|
||||
result.delete(result.length() - 3, result.length());
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static class DataList {
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName(value = "thumbnail", alternate = "path")
|
||||
private String thumbnail;
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
@SerializedName("mask")
|
||||
private String mask;
|
||||
|
||||
public String getId() {
|
||||
return TextUtils.isEmpty(id) ? "" : id;
|
||||
}
|
||||
|
||||
public String getThumbnail() {
|
||||
return TextUtils.isEmpty(thumbnail) ? "" : "http://img1.vbwus.com" + thumbnail;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return TextUtils.isEmpty(title) ? "" : title;
|
||||
}
|
||||
|
||||
public String getMask() {
|
||||
return TextUtils.isEmpty(mask) ? "" : mask;
|
||||
}
|
||||
|
||||
public Vod vod() {
|
||||
return new Vod(getId(), getTitle(), getThumbnail(), getMask());
|
||||
List<String> items = new ArrayList<>();
|
||||
for (SourceListSource source : getSource()) {
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (SourceList item : source.getList()) urls.add(item.getName() + "$" + item.getUrl());
|
||||
items.add(TextUtils.join("#", urls));
|
||||
}
|
||||
return TextUtils.join("$$$", items);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,9 +10,6 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
public class Search {
|
||||
public static Search objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Search.class);
|
||||
}
|
||||
|
||||
@SerializedName("data")
|
||||
private List<Search> data;
|
||||
|
|
@ -25,6 +22,10 @@ public class Search {
|
|||
@SerializedName("mask")
|
||||
private String mask;
|
||||
|
||||
public static Search objectFrom(String str) {
|
||||
return new Gson().fromJson(str, Search.class);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return TextUtils.isEmpty(id) ? "" : id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import com.github.catvod.bean.jianpian.Resp;
|
|||
import com.github.catvod.bean.jianpian.Search;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -24,7 +24,9 @@ import java.util.Map;
|
|||
* Qile
|
||||
*/
|
||||
public class Jianpian extends Spider {
|
||||
private static String siteUrl = "http://api.ubj83.com";
|
||||
|
||||
private final String siteUrl = "http://api.ubj83.com";
|
||||
private String extend;
|
||||
|
||||
private Map<String, String> getHeader() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
|
|
@ -36,18 +38,16 @@ public class Jianpian extends Spider {
|
|||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
if (!extend.isEmpty()) siteUrl = extend;
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws Exception {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("1", "2", "3", "4", "50", "99");
|
||||
List<String> typeNames = Arrays.asList("电影", "电视剧", "动漫", "综艺", "纪录片", "Netflix");
|
||||
for (int i = 0; i < typeIds.size(); i++)
|
||||
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
|
||||
return Result.string(classes, Collections.emptyList());
|
||||
List<String> typeNames = Arrays.asList("電影", "電視劇", "動漫", "綜藝", "紀錄片", "Netflix");
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
return Result.string(classes, JsonParser.parseString(OkHttp.string(extend)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -61,21 +61,25 @@ 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<>();
|
||||
String url;
|
||||
if (tid.equals("50") || tid.equals("99")) {
|
||||
url = siteUrl + String.format("/api/dyTag/list?category_id=%s", tid);
|
||||
if (tid.endsWith("/{pg}")) return searchContent(tid.split("/")[0], pg);
|
||||
if (tid.equals("50") || tid.equals("99") || tid.equals("111")) {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
String url = siteUrl + String.format("/api/dyTag/list?category_id=%s&page=%s", tid, pg);
|
||||
Resp resp = Resp.objectFrom(OkHttp.string(url, getHeader()));
|
||||
for (Data data : resp.getData()) {
|
||||
for (Data.DataList dataList : data.getDataList()) list.add(dataList.vod());
|
||||
}
|
||||
return Result.string(list);
|
||||
for (Data data : resp.getData()) for (Data dataList : data.getDataList()) list.add(dataList.vod());
|
||||
return Result.get().page().vod(list).string();
|
||||
} else {
|
||||
url = siteUrl + String.format("/api/crumb/list?fcate_pid=%s&category_id=&area=&year=&type=&sort=&page=%s", tid, pg);
|
||||
List<Vod> list = new ArrayList<>();
|
||||
HashMap<String, String> ext = new HashMap<>();
|
||||
if (extend != null && !extend.isEmpty()) ext.putAll(extend);
|
||||
String area = ext.get("area") == null ? "0" : ext.get("area");
|
||||
String year = ext.get("year") == null ? "0" : ext.get("year");
|
||||
String by = ext.get("by") == null ? "updata" : ext.get("by");
|
||||
String url = siteUrl + String.format("/api/crumb/list?fcate_pid=%s&area=%s&year=%s&type=0&sort=%s&page=%s&category_id=", tid, area, year, by, pg);
|
||||
Resp resp = Resp.objectFrom(OkHttp.string(url, getHeader()));
|
||||
for (Data data : resp.getData()) list.add(data.vod());
|
||||
return Result.string(list);
|
||||
}
|
||||
Resp resp = Resp.objectFrom(OkHttp.string(url, getHeader()));
|
||||
for (Data data : resp.getData()) list.add(data.vod());
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -89,7 +93,7 @@ public class Jianpian extends Spider {
|
|||
vod.setTypeName(data.getTypes());
|
||||
vod.setVodActor(data.getActors());
|
||||
vod.setVodPlayUrl(data.getVodUrl());
|
||||
vod.setVodDirector("Qile");
|
||||
vod.setVodDirector(data.getDirectors());
|
||||
vod.setVodContent(data.getDescription());
|
||||
return Result.string(vod);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
bcbe9599e27e6b4145eaa583b88b9955
|
||||
eaaa2de0f1e4946be155e3130ef4fdf3
|
||||
|
|
|
|||
|
|
@ -0,0 +1,426 @@
|
|||
{
|
||||
"1": [
|
||||
{
|
||||
"key": "area",
|
||||
"name": "地區",
|
||||
"init": "1",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "国产",
|
||||
"v": "1"
|
||||
},
|
||||
{
|
||||
"n": "中国香港",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "中国台湾",
|
||||
"v": "6"
|
||||
},
|
||||
{
|
||||
"n": "美国",
|
||||
"v": "5"
|
||||
},
|
||||
{
|
||||
"n": "韩国",
|
||||
"v": "18"
|
||||
},
|
||||
{
|
||||
"n": "日本",
|
||||
"v": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"name": "年份",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "2025",
|
||||
"v": "107"
|
||||
},
|
||||
{
|
||||
"n": "2024",
|
||||
"v": "119"
|
||||
},
|
||||
{
|
||||
"n": "2023",
|
||||
"v": "153"
|
||||
},
|
||||
{
|
||||
"n": "2022",
|
||||
"v": "101"
|
||||
},
|
||||
{
|
||||
"n": "2021",
|
||||
"v": "118"
|
||||
},
|
||||
{
|
||||
"n": "2020",
|
||||
"v": "16"
|
||||
},
|
||||
{
|
||||
"n": "2019",
|
||||
"v": "7"
|
||||
},
|
||||
{
|
||||
"n": "2018",
|
||||
"v": "2"
|
||||
},
|
||||
{
|
||||
"n": "2017",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "2016",
|
||||
"v": "22"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "by",
|
||||
"name": "排序",
|
||||
"init": "updata",
|
||||
"value": [
|
||||
{
|
||||
"n": "热门",
|
||||
"v": "hot"
|
||||
},
|
||||
{
|
||||
"n": "更新",
|
||||
"v": "updata"
|
||||
},
|
||||
{
|
||||
"n": "评分",
|
||||
"v": "rating"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"2": [
|
||||
{
|
||||
"key": "area",
|
||||
"name": "地區",
|
||||
"init": "1",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "国产",
|
||||
"v": "1"
|
||||
},
|
||||
{
|
||||
"n": "中国香港",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "中国台湾",
|
||||
"v": "6"
|
||||
},
|
||||
{
|
||||
"n": "美国",
|
||||
"v": "5"
|
||||
},
|
||||
{
|
||||
"n": "韩国",
|
||||
"v": "18"
|
||||
},
|
||||
{
|
||||
"n": "日本",
|
||||
"v": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"name": "年份",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "2025",
|
||||
"v": "107"
|
||||
},
|
||||
{
|
||||
"n": "2024",
|
||||
"v": "119"
|
||||
},
|
||||
{
|
||||
"n": "2023",
|
||||
"v": "153"
|
||||
},
|
||||
{
|
||||
"n": "2022",
|
||||
"v": "101"
|
||||
},
|
||||
{
|
||||
"n": "2021",
|
||||
"v": "118"
|
||||
},
|
||||
{
|
||||
"n": "2020",
|
||||
"v": "16"
|
||||
},
|
||||
{
|
||||
"n": "2019",
|
||||
"v": "7"
|
||||
},
|
||||
{
|
||||
"n": "2018",
|
||||
"v": "2"
|
||||
},
|
||||
{
|
||||
"n": "2017",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "2016",
|
||||
"v": "22"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "by",
|
||||
"name": "排序",
|
||||
"init": "updata",
|
||||
"value": [
|
||||
{
|
||||
"n": "热门",
|
||||
"v": "hot"
|
||||
},
|
||||
{
|
||||
"n": "更新",
|
||||
"v": "updata"
|
||||
},
|
||||
{
|
||||
"n": "评分",
|
||||
"v": "rating"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"key": "area",
|
||||
"name": "地區",
|
||||
"init": "1",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "国产",
|
||||
"v": "1"
|
||||
},
|
||||
{
|
||||
"n": "中国香港",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "中国台湾",
|
||||
"v": "6"
|
||||
},
|
||||
{
|
||||
"n": "美国",
|
||||
"v": "5"
|
||||
},
|
||||
{
|
||||
"n": "韩国",
|
||||
"v": "18"
|
||||
},
|
||||
{
|
||||
"n": "日本",
|
||||
"v": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"name": "年份",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "2025",
|
||||
"v": "107"
|
||||
},
|
||||
{
|
||||
"n": "2024",
|
||||
"v": "119"
|
||||
},
|
||||
{
|
||||
"n": "2023",
|
||||
"v": "153"
|
||||
},
|
||||
{
|
||||
"n": "2022",
|
||||
"v": "101"
|
||||
},
|
||||
{
|
||||
"n": "2021",
|
||||
"v": "118"
|
||||
},
|
||||
{
|
||||
"n": "2020",
|
||||
"v": "16"
|
||||
},
|
||||
{
|
||||
"n": "2019",
|
||||
"v": "7"
|
||||
},
|
||||
{
|
||||
"n": "2018",
|
||||
"v": "2"
|
||||
},
|
||||
{
|
||||
"n": "2017",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "2016",
|
||||
"v": "22"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "by",
|
||||
"name": "排序",
|
||||
"init": "updata",
|
||||
"value": [
|
||||
{
|
||||
"n": "热门",
|
||||
"v": "hot"
|
||||
},
|
||||
{
|
||||
"n": "更新",
|
||||
"v": "updata"
|
||||
},
|
||||
{
|
||||
"n": "评分",
|
||||
"v": "rating"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"4": [
|
||||
{
|
||||
"key": "area",
|
||||
"name": "地區",
|
||||
"init": "1",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "国产",
|
||||
"v": "1"
|
||||
},
|
||||
{
|
||||
"n": "中国香港",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "中国台湾",
|
||||
"v": "6"
|
||||
},
|
||||
{
|
||||
"n": "美国",
|
||||
"v": "5"
|
||||
},
|
||||
{
|
||||
"n": "韩国",
|
||||
"v": "18"
|
||||
},
|
||||
{
|
||||
"n": "日本",
|
||||
"v": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"name": "年份",
|
||||
"value": [
|
||||
{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "2025",
|
||||
"v": "107"
|
||||
},
|
||||
{
|
||||
"n": "2024",
|
||||
"v": "119"
|
||||
},
|
||||
{
|
||||
"n": "2023",
|
||||
"v": "153"
|
||||
},
|
||||
{
|
||||
"n": "2022",
|
||||
"v": "101"
|
||||
},
|
||||
{
|
||||
"n": "2021",
|
||||
"v": "118"
|
||||
},
|
||||
{
|
||||
"n": "2020",
|
||||
"v": "16"
|
||||
},
|
||||
{
|
||||
"n": "2019",
|
||||
"v": "7"
|
||||
},
|
||||
{
|
||||
"n": "2018",
|
||||
"v": "2"
|
||||
},
|
||||
{
|
||||
"n": "2017",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "2016",
|
||||
"v": "22"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "by",
|
||||
"name": "排序",
|
||||
"init": "updata",
|
||||
"value": [
|
||||
{
|
||||
"n": "热门",
|
||||
"v": "hot"
|
||||
},
|
||||
{
|
||||
"n": "更新",
|
||||
"v": "updata"
|
||||
},
|
||||
{
|
||||
"n": "评分",
|
||||
"v": "rating"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue