Fix star
This commit is contained in:
parent
e92ddeab81
commit
6970f6c8fe
|
|
@ -1,96 +0,0 @@
|
||||||
package com.github.catvod.bean.star;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Detail {
|
|
||||||
|
|
||||||
@SerializedName("id")
|
|
||||||
private String id;
|
|
||||||
@SerializedName("videos")
|
|
||||||
private List<Video> videos;
|
|
||||||
@SerializedName("actor")
|
|
||||||
private String actor;
|
|
||||||
@SerializedName("country")
|
|
||||||
private String country;
|
|
||||||
@SerializedName("desc")
|
|
||||||
private String desc;
|
|
||||||
@SerializedName("label")
|
|
||||||
private String label;
|
|
||||||
@SerializedName("director")
|
|
||||||
private String director;
|
|
||||||
@SerializedName("name")
|
|
||||||
private String name;
|
|
||||||
@SerializedName("picurl")
|
|
||||||
private String picurl;
|
|
||||||
@SerializedName("time")
|
|
||||||
private String time;
|
|
||||||
@SerializedName("countStr")
|
|
||||||
private String countStr;
|
|
||||||
|
|
||||||
public static Detail objectFrom(String str) {
|
|
||||||
return new Gson().fromJson(str, Detail.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Video> getVideos() {
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getActor() {
|
|
||||||
return actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
|
||||||
return country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDirector() {
|
|
||||||
return director;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPicurl() {
|
|
||||||
return picurl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountStr() {
|
|
||||||
return countStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Video {
|
|
||||||
|
|
||||||
@SerializedName("eporder")
|
|
||||||
private Integer eporder;
|
|
||||||
@SerializedName("purl")
|
|
||||||
private String purl;
|
|
||||||
|
|
||||||
public Integer getEporder() {
|
|
||||||
return eporder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPurl() {
|
|
||||||
return purl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Group {
|
||||||
|
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("videos")
|
||||||
|
private List<Video> videos;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Video> getVideos() {
|
||||||
|
return videos == null ? Collections.emptyList() : videos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Info {
|
||||||
|
|
||||||
|
@SerializedName("videosGroup")
|
||||||
|
private List<Group> videosGroup;
|
||||||
|
@SerializedName("actor")
|
||||||
|
private List<Person> actor;
|
||||||
|
@SerializedName("country")
|
||||||
|
private String country;
|
||||||
|
@SerializedName("desc")
|
||||||
|
private String desc;
|
||||||
|
@SerializedName("director")
|
||||||
|
private List<Person> director;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("picurl")
|
||||||
|
private String picurl;
|
||||||
|
@SerializedName("time")
|
||||||
|
private String time;
|
||||||
|
@SerializedName("countStr")
|
||||||
|
private String countStr;
|
||||||
|
|
||||||
|
public static Info objectFrom(String str) {
|
||||||
|
return new Gson().fromJson(str, Info.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Group> getVideosGroup() {
|
||||||
|
return videosGroup == null ? Collections.emptyList() : videosGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Person> getActor() {
|
||||||
|
return actor == null ? Collections.emptyList() : actor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return TextUtils.isEmpty(country) ? "" : country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return TextUtils.isEmpty(desc) ? "" : desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Person> getDirector() {
|
||||||
|
return director == null ? Collections.emptyList() : director;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPicurl() {
|
||||||
|
return TextUtils.isEmpty(picurl) ? "" : picurl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return TextUtils.isEmpty(time) ? "" : time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountStr() {
|
||||||
|
return TextUtils.isEmpty(countStr) ? "" : countStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Person {
|
||||||
|
|
||||||
|
@SerializedName("id")
|
||||||
|
private int id;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.github.catvod.bean.star;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class Video {
|
||||||
|
|
||||||
|
@SerializedName("purl")
|
||||||
|
private String purl;
|
||||||
|
@SerializedName("eporder")
|
||||||
|
private int eporder;
|
||||||
|
|
||||||
|
public String getPurl() {
|
||||||
|
return TextUtils.isEmpty(purl) ? "" : purl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEporder() {
|
||||||
|
return eporder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ import android.widget.Button;
|
||||||
import com.github.catvod.R;
|
import com.github.catvod.R;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
import com.github.catvod.spider.Yingshiche;
|
import com.github.catvod.spider.Star;
|
||||||
import com.orhanobut.logger.AndroidLogAdapter;
|
import com.orhanobut.logger.AndroidLogAdapter;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class MainActivity extends Activity {
|
||||||
private void initSpider() {
|
private void initSpider() {
|
||||||
try {
|
try {
|
||||||
Init.init(getApplicationContext());
|
Init.init(getApplicationContext());
|
||||||
spider = new Yingshiche();
|
spider = new Star();
|
||||||
spider.init(this, "");
|
spider.init(this, "");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -71,7 +71,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
public void categoryContent() {
|
public void categoryContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("categoryContent").d(spider.categoryContent("tid", "1", true, new HashMap<>()));
|
Logger.t("categoryContent").d(spider.categoryContent("movie", "1", true, new HashMap<>()));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
public void detailContent() {
|
public void detailContent() {
|
||||||
try {
|
try {
|
||||||
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("/voddetail/5553.html")));
|
Logger.t("detailContent").d(spider.detailContent(Arrays.asList("2121173431")));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,11 @@ import com.github.catvod.bean.Result;
|
||||||
import com.github.catvod.bean.Vod;
|
import com.github.catvod.bean.Vod;
|
||||||
import com.github.catvod.bean.star.Card;
|
import com.github.catvod.bean.star.Card;
|
||||||
import com.github.catvod.bean.star.Condition;
|
import com.github.catvod.bean.star.Condition;
|
||||||
import com.github.catvod.bean.star.Detail;
|
import com.github.catvod.bean.star.Group;
|
||||||
|
import com.github.catvod.bean.star.Info;
|
||||||
|
import com.github.catvod.bean.star.Person;
|
||||||
import com.github.catvod.bean.star.Query;
|
import com.github.catvod.bean.star.Query;
|
||||||
|
import com.github.catvod.bean.star.Video;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
|
|
@ -40,7 +43,7 @@ public class Star extends Spider {
|
||||||
private Map<String, String> getHeader() {
|
private Map<String, String> getHeader() {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("User-Agent", Util.CHROME);
|
headers.put("User-Agent", Util.CHROME);
|
||||||
headers.put("Cookie", "userIP=127.0.0.1; aws-waf-token=");
|
headers.put("Cookie", "userIP=64.252.112.99;");
|
||||||
headers.put("Referer", siteUrl);
|
headers.put("Referer", siteUrl);
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +69,6 @@ public class Star extends Spider {
|
||||||
map.put("drama", "电视剧");
|
map.put("drama", "电视剧");
|
||||||
map.put("animation", "动漫");
|
map.put("animation", "动漫");
|
||||||
map.put("variety", "综艺");
|
map.put("variety", "综艺");
|
||||||
map.put("documentary", "纪录片");
|
|
||||||
ver = getVer();
|
ver = getVer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,6 +97,7 @@ public class Star extends Spider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
|
if (tid.endsWith("/{pg}")) return searchContent(tid.split("/")[0], true);
|
||||||
String year = extend.containsKey("year") ? extend.get("year") : "";
|
String year = extend.containsKey("year") ? extend.get("year") : "";
|
||||||
String type = extend.containsKey("type") ? extend.get("type") : "";
|
String type = extend.containsKey("type") ? extend.get("type") : "";
|
||||||
String area = extend.containsKey("area") ? extend.get("area") : "";
|
String area = extend.containsKey("area") ? extend.get("area") : "";
|
||||||
|
|
@ -115,22 +118,27 @@ public class Star extends Spider {
|
||||||
@Override
|
@Override
|
||||||
public String detailContent(List<String> ids) throws Exception {
|
public String detailContent(List<String> ids) throws Exception {
|
||||||
Element script = Jsoup.parse(OkHttp.string(client(), detail.concat(ids.get(0)), getHeader())).select("#__NEXT_DATA__").get(0);
|
Element script = Jsoup.parse(OkHttp.string(client(), detail.concat(ids.get(0)), getHeader())).select("#__NEXT_DATA__").get(0);
|
||||||
Detail detail = Detail.objectFrom(new JSONObject(script.data()).getJSONObject("props").getJSONObject("pageProps").getJSONObject("pageData").toString());
|
Info detail = Info.objectFrom(new JSONObject(script.data()).getJSONObject("props").getJSONObject("pageProps").getJSONObject("collectionInfo").toString());
|
||||||
Vod vod = new Vod();
|
Vod vod = new Vod();
|
||||||
vod.setVodId(ids.get(0));
|
vod.setVodId(ids.get(0));
|
||||||
vod.setVodPic(detail.getPicurl());
|
|
||||||
vod.setVodYear(detail.getTime());
|
vod.setVodYear(detail.getTime());
|
||||||
vod.setVodName(detail.getName());
|
vod.setVodName(detail.getName());
|
||||||
|
vod.setVodPic(detail.getPicurl());
|
||||||
vod.setVodArea(detail.getCountry());
|
vod.setVodArea(detail.getCountry());
|
||||||
vod.setVodActor(detail.getActor());
|
|
||||||
vod.setVodRemarks(detail.getCountStr());
|
|
||||||
vod.setVodContent(detail.getDesc());
|
vod.setVodContent(detail.getDesc());
|
||||||
vod.setVodDirector(detail.getDirector());
|
vod.setVodRemarks(detail.getCountStr());
|
||||||
vod.setTypeName(detail.getLabel());
|
vod.setVodActor(convert(detail.getActor()));
|
||||||
vod.setVodPlayFrom("FongMi");
|
vod.setVodDirector(convert(detail.getDirector()));
|
||||||
|
List<String> playFrom = new ArrayList<>();
|
||||||
List<String> playUrls = new ArrayList<>();
|
List<String> playUrls = new ArrayList<>();
|
||||||
for (Detail.Video video : detail.getVideos()) playUrls.add(video.getEporder() + "$" + video.getPurl());
|
for (Group group : detail.getVideosGroup()) {
|
||||||
vod.setVodPlayUrl(TextUtils.join("#", playUrls));
|
List<String> urls = new ArrayList<>();
|
||||||
|
for (Video video : group.getVideos()) urls.add(video.getEporder() + "$" + video.getPurl());
|
||||||
|
playUrls.add(TextUtils.join("#", urls));
|
||||||
|
playFrom.add(group.getName());
|
||||||
|
}
|
||||||
|
vod.setVodPlayUrl(TextUtils.join("$$$", playUrls));
|
||||||
|
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
|
||||||
return Result.string(vod);
|
return Result.string(vod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,12 +148,18 @@ public class Star extends Spider {
|
||||||
String json = OkHttp.string(client(), siteUrl + data + ver + "/search.json?word=" + URLEncoder.encode(key), getHeader());
|
String json = OkHttp.string(client(), siteUrl + data + ver + "/search.json?word=" + URLEncoder.encode(key), getHeader());
|
||||||
List<Card> items = Card.arrayFrom(new JSONObject(json).getJSONObject("pageProps").getJSONArray("initList").toString());
|
List<Card> items = Card.arrayFrom(new JSONObject(json).getJSONObject("pageProps").getJSONArray("initList").toString());
|
||||||
for (Card item : items) list.add(item.vod());
|
for (Card item : items) list.add(item.vod());
|
||||||
return Result.string(list);
|
return Result.get().vod(list).page().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
return Result.get().url(id).string();
|
return Result.get().url(id).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convert(List<Person> items) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (Person item : items) sb.append(String.format("[a=cr:{\"id\":\"%s\",\"name\":\"%s\"}/]%s[/a]", item.getName() + "/{pg}", item.getName(), item.getName())).append(",");
|
||||||
|
return Util.substring(sb.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
1d4ff8f544bca8e9c4c931bc67f186c9
|
79ce46d06a14fbf6a8032fb0b1d5b98a
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue