| 18 | import java.util.List; |
| 19 | |
| 20 | public class Push extends Spider { |
| 21 | |
| 22 | @Override |
| 23 | public String detailContent(List<String> ids) { |
| 24 | return Result.string(vod(ids.get(0))); |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public String playerContent(String flag, String id, List<String> vipFlags) { |
| 29 | if (id.contains("://") && id.contains("***")) id = id.replace("***", "#"); |
| 30 | return switch (flag) { |
| 31 | case "直連" -> Result.get().url(id).subs(getSubs(id)).string(); |
| 32 | case "解析" -> Result.get().parse().jx().url(id).string(); |
| 33 | case "嗅探" -> Result.get().parse().url(id).string(); |
| 34 | default -> Result.get().url(id).string(); |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | private Vod vod(String url) { |
| 39 | Vod vod = new Vod(); |
| 40 | vod.setVodId(url); |
| 41 | vod.setVodPic(Image.PUSH); |
| 42 | vod.setTypeName("FongMi"); |
| 43 | vod.setVodName(url.startsWith("file://") ? new File(url).getName() : ""); |
| 44 | if (url.contains("://") && url.contains("#")) url = url.replace("#", "***"); |
| 45 | if (Util.isThunder(url)) { |
| 46 | vod.setVodPlayUrl(url); |
| 47 | vod.setVodPlayFrom("迅雷"); |
| 48 | } else if (url.contains("youtube.com")) { |
| 49 | vod.setVodPlayUrl(url); |
| 50 | vod.setVodPlayFrom("YouTube"); |
| 51 | } else if (url.contains("$")) { |
| 52 | vod.setVodPlayFrom("直連"); |
| 53 | vod.setVodPlayUrl(TextUtils.join("#", url.split("\n"))); |
| 54 | } else { |
| 55 | vod.setVodPlayUrl(TextUtils.join("$$$", Arrays.asList(url, url, url))); |
| 56 | vod.setVodPlayFrom(TextUtils.join("$$$", Arrays.asList("直連", "嗅探", "解析"))); |
| 57 | } |
| 58 | return vod; |
| 59 | } |
| 60 | |
| 61 | private List<Sub> getSubs(String url) { |
| 62 | List<Sub> subs = new ArrayList<>(); |
| 63 | if (url.startsWith("file://")) setFileSub(url, subs); |
| 64 | if (url.startsWith("http://")) setHttpSub(url, subs); |
| 65 | return subs; |
| 66 | } |
| 67 | |
| 68 | private void setHttpSub(String url, List<Sub> subs) { |
| 69 | List<String> vodTypes = Arrays.asList("mp4", "mkv"); |
| 70 | List<String> subTypes = Arrays.asList("srt", "ass"); |
| 71 | if (!vodTypes.contains(Util.getExt(url))) return; |
| 72 | for (String ext : subTypes) detectSub(url, ext, subs); |
| 73 | } |
| 74 | |
| 75 | private void detectSub(String url, String ext, List<Sub> subs) { |
| 76 | url = Util.removeExt(url).concat(".").concat(ext); |
| 77 | if (OkHttp.string(url).length() < 100) return; |
nothing calls this directly
no outgoing calls
no test coverage detected