Clean trans system
This commit is contained in:
parent
0edcb9d308
commit
155066d132
|
|
@ -24,7 +24,6 @@ import com.github.catvod.spider.Init;
|
|||
import com.github.catvod.spider.Proxy;
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.github.catvod.utils.QRCode;
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
|
@ -259,7 +258,7 @@ public class API {
|
|||
List<String> playFrom = Arrays.asList("原畫", "超清", "高清");
|
||||
List<String> episode = new ArrayList<>();
|
||||
List<String> playUrl = new ArrayList<>();
|
||||
for (Item file : files) episode.add(Trans.get(file.getDisplayName()) + "$" + file.getFileId() + findSubs(file.getName(), subMap));
|
||||
for (Item file : files) episode.add(file.getDisplayName() + "$" + file.getFileId() + findSubs(file.getName(), subMap));
|
||||
for (int i = 0; i < playFrom.size(); i++) playUrl.add(TextUtils.join("#", episode));
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(url);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.github.catvod.bean;
|
||||
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
|
@ -19,9 +18,7 @@ public class Class {
|
|||
|
||||
public static List<Class> arrayFrom(String str) {
|
||||
Type listType = new TypeToken<List<Class>>() {}.getType();
|
||||
List<Class> items = new Gson().fromJson(str, listType);
|
||||
for (Class item : items) item.typeName = Trans.get(item.typeName);
|
||||
return items;
|
||||
return new Gson().fromJson(str, listType);
|
||||
}
|
||||
|
||||
public Class(String typeId) {
|
||||
|
|
@ -34,7 +31,7 @@ public class Class {
|
|||
|
||||
public Class(String typeId, String typeName, String typeFlag) {
|
||||
this.typeId = typeId;
|
||||
this.typeName = Trans.get(typeName);
|
||||
this.typeName = typeName;
|
||||
this.typeFlag = typeFlag;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.github.catvod.bean;
|
||||
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -16,15 +15,10 @@ public class Filter {
|
|||
|
||||
public Filter(String key, String name, List<Value> value) {
|
||||
this.key = key;
|
||||
this.name = Trans.get(name);
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void trans() {
|
||||
name = Trans.get(name);
|
||||
for (Value item : value) item.n = Trans.get(item.n);
|
||||
}
|
||||
|
||||
public static class Value {
|
||||
|
||||
@SerializedName("n")
|
||||
|
|
@ -33,12 +27,12 @@ public class Filter {
|
|||
private String v;
|
||||
|
||||
public Value(String value) {
|
||||
this.n = Trans.get(value);
|
||||
this.n = value;
|
||||
this.v = value;
|
||||
}
|
||||
|
||||
public Value(String n, String v) {
|
||||
this.n = Trans.get(n);
|
||||
this.n = n;
|
||||
this.v = v;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Result {
|
||||
|
||||
|
|
@ -102,9 +101,7 @@ public class Result {
|
|||
public Result filters(JSONObject object) {
|
||||
if (object == null) return this;
|
||||
Type listType = new TypeToken<LinkedHashMap<String, List<Filter>>>() {}.getType();
|
||||
LinkedHashMap<String, List<Filter>> filters = new Gson().fromJson(object.toString(), listType);
|
||||
for (Map.Entry<String, List<Filter>> entry : filters.entrySet()) for (Filter filter : entry.getValue()) filter.trans();
|
||||
this.filters = filters;
|
||||
this.filters = new Gson().fromJson(object.toString(), listType);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.github.catvod.bean;
|
||||
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Sub {
|
||||
|
|
@ -19,7 +18,7 @@ public class Sub {
|
|||
}
|
||||
|
||||
public Sub name(String name) {
|
||||
this.name = Trans.get(name);
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.github.catvod.bean;
|
||||
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Vod {
|
||||
|
|
@ -57,7 +56,7 @@ public class Vod {
|
|||
}
|
||||
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = Trans.get(typeName);
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public void setVodId(String vodId) {
|
||||
|
|
@ -65,7 +64,7 @@ public class Vod {
|
|||
}
|
||||
|
||||
public void setVodName(String vodName) {
|
||||
this.vodName = Trans.get(vodName);
|
||||
this.vodName = vodName;
|
||||
}
|
||||
|
||||
public void setVodPic(String vodPic) {
|
||||
|
|
@ -73,27 +72,27 @@ public class Vod {
|
|||
}
|
||||
|
||||
public void setVodRemarks(String vodRemarks) {
|
||||
this.vodRemarks = Trans.get(vodRemarks);
|
||||
this.vodRemarks = vodRemarks;
|
||||
}
|
||||
|
||||
public void setVodYear(String vodYear) {
|
||||
this.vodYear = Trans.get(vodYear);
|
||||
this.vodYear = vodYear;
|
||||
}
|
||||
|
||||
public void setVodArea(String vodArea) {
|
||||
this.vodArea = Trans.get(vodArea);
|
||||
this.vodArea = vodArea;
|
||||
}
|
||||
|
||||
public void setVodActor(String vodActor) {
|
||||
this.vodActor = Trans.get(vodActor);
|
||||
this.vodActor = vodActor;
|
||||
}
|
||||
|
||||
public void setVodDirector(String vodDirector) {
|
||||
this.vodDirector = Trans.get(vodDirector);
|
||||
this.vodDirector = vodDirector;
|
||||
}
|
||||
|
||||
public void setVodContent(String vodContent) {
|
||||
this.vodContent = Trans.get(vodContent);
|
||||
this.vodContent = vodContent;
|
||||
}
|
||||
|
||||
public String getVodContent() {
|
||||
|
|
@ -101,7 +100,7 @@ public class Vod {
|
|||
}
|
||||
|
||||
public void setVodPlayFrom(String vodPlayFrom) {
|
||||
this.vodPlayFrom = Trans.get(vodPlayFrom);
|
||||
this.vodPlayFrom = vodPlayFrom;
|
||||
}
|
||||
|
||||
public void setVodPlayUrl(String vodPlayUrl) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import com.github.catvod.bean.alist.Item;
|
|||
import com.github.catvod.bean.alist.Sorter;
|
||||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
|
@ -105,7 +104,7 @@ public class AList extends Spider {
|
|||
List<String> playUrls = new ArrayList<>();
|
||||
for (Item item : parents) {
|
||||
if (item.isMedia(drive.isNew())) {
|
||||
playUrls.add(Trans.get(item.getName()) + "$" + item.getVodId(path) + findSubs(path, parents));
|
||||
playUrls.add(item.getName() + "$" + item.getVodId(path) + findSubs(path, parents));
|
||||
}
|
||||
}
|
||||
Vod vod = new Vod();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.github.catvod.crawler.Spider;
|
|||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Prefers;
|
||||
import com.github.catvod.utils.QRCode;
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
|
@ -125,7 +124,7 @@ public class Bili extends Spider {
|
|||
for (int i = 0; i < pages.length(); ++i) {
|
||||
JSONObject page = pages.getJSONObject(i);
|
||||
String title = page.getString("part").replace("$", "_").replace("#", "_");
|
||||
playlist.add(Trans.get(title) + "$" + aid + "+" + page.getLong("cid"));
|
||||
playlist.add(title + "$" + aid + "+" + page.getLong("cid"));
|
||||
}
|
||||
Vod vod = new Vod();
|
||||
vod.setVodId(bvid);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.github.catvod.bean.Vod;
|
|||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Utils;
|
||||
import com.github.catvod.utils.Trans;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
|
@ -141,7 +140,7 @@ public class Dm84 extends Spider {
|
|||
List<String> vodItems = new ArrayList<>();
|
||||
for (int j = 0; j < playList.size(); j++) {
|
||||
Element e = playList.get(j);
|
||||
vodItems.add(Trans.get(e.text()) + "$" + e.attr("href"));
|
||||
vodItems.add(e.text() + "$" + e.attr("href"));
|
||||
}
|
||||
if (vodItems.size() > 0) {
|
||||
sites.put(sourceName, TextUtils.join("#", vodItems));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import android.os.Looper;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.utils.Trans;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
|
@ -41,7 +40,6 @@ public class Init {
|
|||
public static void init(Context context) {
|
||||
SpiderDebug.log("自定義爬蟲代碼載入成功!");
|
||||
get().app = ((Application) context);
|
||||
Trans.init();
|
||||
}
|
||||
|
||||
public static void execute(Runnable runnable) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.github.catvod.bean.xpath.Rule;
|
|||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
|
@ -223,7 +222,7 @@ public class XPath extends Spider {
|
|||
name = rule.getDetailUrlNameR(name);
|
||||
String id = urlNodes.get(j).selOne(rule.getDetailUrlId()).asString().trim();
|
||||
id = rule.getDetailUrlIdR(id);
|
||||
vodItems.add(Trans.get(name) + "$" + id);
|
||||
vodItems.add(name + "$" + id);
|
||||
}
|
||||
// 排除播放列表為空的播放源
|
||||
if (vodItems.size() == 0 && playFrom.size() > i) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import android.text.TextUtils;
|
|||
import android.util.Base64;
|
||||
|
||||
import com.github.catvod.crawler.SpiderDebug;
|
||||
import com.github.catvod.utils.Trans;
|
||||
import com.github.catvod.utils.Utils;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
|
@ -56,7 +55,7 @@ public class XPathMac extends XPath {
|
|||
Iterator<String> keys = dcShow2Vip.keys();
|
||||
while (keys.hasNext()) {
|
||||
String name = keys.next();
|
||||
show2VipFlag.put(Trans.get(name.trim()), dcShow2Vip.getString(name).trim());
|
||||
show2VipFlag.put(name.trim(), dcShow2Vip.getString(name).trim());
|
||||
}
|
||||
}
|
||||
playerConfigJs = jsonObj.optString("pCfgJs").trim();
|
||||
|
|
@ -82,7 +81,7 @@ public class XPathMac extends XPath {
|
|||
if (keyObj == null) continue;
|
||||
String show = keyObj.optString("show").trim();
|
||||
if (show.isEmpty()) continue;
|
||||
show2VipFlag.put(Trans.get(show), key);
|
||||
show2VipFlag.put(show, key);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SpiderDebug.log(e);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.github.catvod.bean.Vod;
|
|||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Utils;
|
||||
import com.github.catvod.utils.Trans;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
|
@ -136,7 +135,7 @@ public class Ying extends Spider {
|
|||
List<String> vodItems = new ArrayList<>();
|
||||
for (int j = 0; j < playList.size(); j++) {
|
||||
Element e = playList.get(j);
|
||||
vodItems.add(Trans.get(e.text()) + "$" + e.attr("href"));
|
||||
vodItems.add(e.text() + "$" + e.attr("href"));
|
||||
}
|
||||
if (vodItems.size() > 0) {
|
||||
sites.put(sourceName, TextUtils.join("#", vodItems));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.github.catvod.bean.Vod;
|
|||
import com.github.catvod.crawler.Spider;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.utils.Utils;
|
||||
import com.github.catvod.utils.Trans;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
|
@ -131,7 +130,7 @@ public class Ysj extends Spider {
|
|||
for (int j = 0; j < playList.size(); j++) {
|
||||
Element e = playList.get(j);
|
||||
String href = e.attr("href").replace(playUrl, "");
|
||||
vodItems.add(Trans.get(e.text()) + "$" + href);
|
||||
vodItems.add(e.text() + "$" + href);
|
||||
}
|
||||
if (vodItems.size() > 0) {
|
||||
sites.put(sourceName, TextUtils.join("#", vodItems));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
f2064f61914f9fe0258820ab04b5abce
|
||||
fec1811bad085e87682f64be8bc9885a
|
||||
|
|
|
|||
Loading…
Reference in New Issue