Clean code
This commit is contained in:
parent
e178cf9994
commit
e953cd173b
|
|
@ -46,8 +46,7 @@ public class Kanqiu extends Spider {
|
|||
List<Class> classes = new ArrayList<>();
|
||||
List<String> typeIds = Arrays.asList("", "1", "8", "29");
|
||||
List<String> typeNames = Arrays.asList("全部直播", "篮球直播", "足球直播", "其他直播");
|
||||
for (int i = 0; i < typeIds.size(); i++)
|
||||
classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
for (int i = 0; i < typeIds.size(); i++) classes.add(new Class(typeIds.get(i), typeNames.get(i)));
|
||||
String f = "{\"1\": [{\"key\": \"cateId\", \"name\": \"类型\", \"value\": [{\"n\": \"NBA\", \"v\": \"1\"}, {\"n\": \"CBA\", \"v\": \"2\"}, {\"n\": \"篮球综合\", \"v\": \"4\"}, {\"n\": \"纬来体育\", \"v\": \"21\"}]}],\"8\": [{\"key\": \"cateId\", \"name\": \"类型\", \"value\": [{\"n\": \"英超\", \"v\": \"8\"}, {\"n\": \"西甲\", \"v\": \"9\"}, {\"n\": \"意甲\", \"v\": \"10\"}, {\"n\": \"欧冠\", \"v\": \"12\"}, {\"n\": \"欧联\", \"v\": \"13\"}, {\"n\": \"德甲\", \"v\": \"14\"}, {\"n\": \"法甲\", \"v\": \"15\"}, {\"n\": \"欧国联\", \"v\": \"16\"}, {\"n\": \"足总杯\", \"v\": \"27\"}, {\"n\": \"国王杯\", \"v\": \"33\"}, {\"n\": \"中超\", \"v\": \"7\"}, {\"n\": \"亚冠\", \"v\": \"11\"}, {\"n\": \"足球综合\", \"v\": \"23\"}, {\"n\": \"欧协联\", \"v\": \"28\"}, {\"n\": \"美职联\", \"v\": \"26\"}]}], \"29\": [{\"key\": \"cateId\", \"name\": \"类型\", \"value\": [{\"n\": \"网球\", \"v\": \"29\"}, {\"n\": \"斯洛克\", \"v\": \"30\"}, {\"n\": \"MLB\", \"v\": \"38\"}, {\"n\": \"UFC\", \"v\": \"32\"}, {\"n\": \"NFL\", \"v\": \"25\"}, {\"n\": \"CCTV5\", \"v\": \"18\"}]}]}";
|
||||
JSONObject filterConfig = new JSONObject(f);
|
||||
return Result.string(classes, filterConfig);
|
||||
|
|
@ -56,12 +55,7 @@ public class Kanqiu extends Spider {
|
|||
@Override
|
||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||
String cateId = extend.get("cateId") == null ? tid : extend.get("cateId");
|
||||
String cateUrl;
|
||||
if (cateId == null || cateId.isEmpty()) {
|
||||
cateUrl = siteUrl + String.format("%s", tid);
|
||||
} else {
|
||||
cateUrl = siteUrl + String.format("/match/%s/live", cateId);
|
||||
}
|
||||
String cateUrl = siteUrl + (TextUtils.isEmpty(cateId) ? String.format("%s", tid) : String.format("/match/%s/live", cateId));
|
||||
Document doc = Jsoup.parse(OkHttp.string(cateUrl, getHeader()));
|
||||
List<Vod> list = new ArrayList<>();
|
||||
int Size = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue