Update pansou

This commit is contained in:
FongMi 2022-11-17 21:41:59 +08:00
parent d9383de2aa
commit 12ea126a78
7 changed files with 31 additions and 41 deletions

View File

@ -33,13 +33,13 @@ public class Result {
@SerializedName("jx")
private int jx;
@SerializedName("page")
private int Page;
private int page;
@SerializedName("pagecount")
private int PageCount;
private int pagecount;
@SerializedName("limit")
private int Limit;
private int limit;
@SerializedName("total")
private int Total;
private int total;
public static String string(List<Class> classes, List<Vod> list, LinkedHashMap<String, List<Filter>> filters) {
return Result.get().classes(classes).vod(list).filters(filters).string();
@ -95,7 +95,8 @@ public class Result {
public Result filters(JSONObject object) {
if (object == null) return this;
Type listType = new TypeToken<LinkedHashMap<String, List<Filter>>>() {}.getType();
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;
@ -133,6 +134,18 @@ public class Result {
return this;
}
public Result page() {
return page(1, 1, 0, 1);
}
public Result page(int page, int count, int limit, int total) {
this.page = page > 0 ? page : Integer.MAX_VALUE;
this.limit = limit > 0 ? limit : Integer.MAX_VALUE;
this.total = total > 0 ? total : Integer.MAX_VALUE;
this.pagecount = count > 0 ? page : Integer.MAX_VALUE;
return this;
}
public List<Vod> getList() {
return list == null ? Collections.emptyList() : list;
}
@ -145,28 +158,4 @@ public class Result {
public String toString() {
return new Gson().toJson(this);
}
public Result pageSetup(int Page, int PageCount, int Limit, int Total) {
if (Page > 0) {
this.Page = Page;
} else {
this.Page = Integer.MAX_VALUE;
}
if (PageCount > 0) {
this.PageCount = PageCount;
} else {
this.PageCount = Integer.MAX_VALUE;
}
if (Limit > 0) {
this.Limit = Limit;
} else {
this.Limit = Integer.MAX_VALUE;
}
if (Total > 0) {
this.Total = Total;
} else {
this.Total = Integer.MAX_VALUE;
}
return this;
}
}

View File

@ -70,11 +70,15 @@ public class Item {
return TextUtils.isEmpty(category) ? "" : category;
}
public String getDisplayName(String fileName, String size) { return getSize().isEmpty() ? "[" + size + "]" + fileName : fileName; }
public double getSize() {
return size;
}
public String getDisplayName() {
return getSize() == 0 ? getName() : "[" + Misc.getSize(getSize()) + "] " + getName();
}
public String removeExt() {
return getName().indexOf(".") > 0 ? getName().substring(0, getName().lastIndexOf(".")) : getName();
}
public String getSize() { return TextUtils.isEmpty(Misc.getSize(size)) ? "" : Misc.getSize(size); }
}

View File

@ -116,7 +116,7 @@ public class AList extends Spider {
Sorter.sort(type, order, files);
for (Item item : folders) list.add(item.getVod(tid));
for (Item item : files) list.add(item.getVod(tid));
return Result.get().vod(list).pageSetup(1, 1, 0, 1).string();
return Result.get().vod(list).page().string();
}
@Override

View File

@ -112,10 +112,7 @@ public class Ali {
List<String> playUrls = new ArrayList<>();
List<String> names = new ArrayList<>(name2id.keySet());
for (String name : names) playUrls.add(Trans.get(name) + "$" + name2id.get(name) + findSubs(name, subMap));
if (playUrls.isEmpty()) {
playUrls.add("无数据$无数据");
Init.show("來晚啦,該分享已失效。");
}
if (playUrls.isEmpty()) playUrls.add("无数据$无数据");
List<String> sourceUrls = new ArrayList<>();
sourceUrls.add(TextUtils.join("#", playUrls));
sourceUrls.add(TextUtils.join("#", playUrls));
@ -148,7 +145,7 @@ public class Ali {
if (file.getType().equals("folder")) {
folders.add(file);
} else if (file.getCategory().equals("video") || file.getCategory().equals("audio")) {
name2id.put(parent.getDisplayName(file.getName(), file.getSize()), shareId + "+" + shareToken + "+" + file.getFileId());
name2id.put(file.getDisplayName(), shareId + "+" + shareToken + "+" + file.getFileId());
} else if (Misc.isSub(file.getExt())) {
String key = file.removeExt();
if (!subMap.containsKey(key)) subMap.put(key, new ArrayList<>());

View File

@ -32,7 +32,7 @@ public class PanSou extends Spider {
HashMap<String, String> headers = new HashMap<>();
headers.put("User-Agent", Misc.CHROME);
headers.put("Referer", siteUrl + id);
headers.put("_bid", "d1810141fb539895ce233cdf66414ca7");
headers.put("_bid", "6d14a5dd6c07980d9dc089a693805ad8");
return headers;
}
@ -43,7 +43,7 @@ public class PanSou extends Spider {
@Override
public String detailContent(List<String> ids) throws Exception {
String url = siteUrl + ids.get(0).replace("s", "cv");
String url = siteUrl + ids.get(0).replace("/s/", "/cv/");
Map<String, List<String>> respHeaders = new HashMap<>();
OkHttpUtil.stringNoRedirect(url, getHeaders(ids.get(0)), respHeaders);
url = OkHttpUtil.getRedirectLocation(respHeaders);

Binary file not shown.

View File

@ -1 +1 @@
1d6994a4a39ca10ec37a3936e5cad909
a420c6cc18e20d8eff5bafdada357669