|
|
|
|
@ -9,8 +9,11 @@ import com.github.catvod.bean.Result; |
|
|
|
|
import com.github.catvod.bean.Vod; |
|
|
|
|
import com.github.catvod.bean.star.Card; |
|
|
|
|
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.Video; |
|
|
|
|
import com.github.catvod.crawler.Spider; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.github.catvod.utils.Util; |
|
|
|
|
@ -40,7 +43,7 @@ public class Star extends Spider { |
|
|
|
|
private Map<String, String> getHeader() { |
|
|
|
|
Map<String, String> headers = new HashMap<>(); |
|
|
|
|
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); |
|
|
|
|
return headers; |
|
|
|
|
} |
|
|
|
|
@ -66,7 +69,6 @@ public class Star extends Spider { |
|
|
|
|
map.put("drama", "电视剧"); |
|
|
|
|
map.put("animation", "动漫"); |
|
|
|
|
map.put("variety", "综艺"); |
|
|
|
|
map.put("documentary", "纪录片"); |
|
|
|
|
ver = getVer(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -95,6 +97,7 @@ public class Star extends Spider { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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 type = extend.containsKey("type") ? extend.get("type") : ""; |
|
|
|
|
String area = extend.containsKey("area") ? extend.get("area") : ""; |
|
|
|
|
@ -115,22 +118,27 @@ public class Star extends Spider { |
|
|
|
|
@Override |
|
|
|
|
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); |
|
|
|
|
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.setVodId(ids.get(0)); |
|
|
|
|
vod.setVodPic(detail.getPicurl()); |
|
|
|
|
vod.setVodYear(detail.getTime()); |
|
|
|
|
vod.setVodName(detail.getName()); |
|
|
|
|
vod.setVodPic(detail.getPicurl()); |
|
|
|
|
vod.setVodArea(detail.getCountry()); |
|
|
|
|
vod.setVodActor(detail.getActor()); |
|
|
|
|
vod.setVodRemarks(detail.getCountStr()); |
|
|
|
|
vod.setVodContent(detail.getDesc()); |
|
|
|
|
vod.setVodDirector(detail.getDirector()); |
|
|
|
|
vod.setTypeName(detail.getLabel()); |
|
|
|
|
vod.setVodPlayFrom("FongMi"); |
|
|
|
|
vod.setVodRemarks(detail.getCountStr()); |
|
|
|
|
vod.setVodActor(convert(detail.getActor())); |
|
|
|
|
vod.setVodDirector(convert(detail.getDirector())); |
|
|
|
|
List<String> playFrom = new ArrayList<>(); |
|
|
|
|
List<String> playUrls = new ArrayList<>(); |
|
|
|
|
for (Detail.Video video : detail.getVideos()) playUrls.add(video.getEporder() + "$" + video.getPurl()); |
|
|
|
|
vod.setVodPlayUrl(TextUtils.join("#", playUrls)); |
|
|
|
|
for (Group group : detail.getVideosGroup()) { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -140,12 +148,18 @@ public class Star extends Spider { |
|
|
|
|
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()); |
|
|
|
|
for (Card item : items) list.add(item.vod()); |
|
|
|
|
return Result.string(list); |
|
|
|
|
return Result.get().vod(list).page().string(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { |
|
|
|
|
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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|