* @param url * 资源地址 * @return * 返回子页列表 */public ArrayList crawlDetail(String url) throws IOException { // TODO return null;} /** * 获取视频详情页信息 * @param url 详情页url * @return */ public Video getVideoDetail(String url) { try { Cdoc doc = download(url); Video video = new Video(); String title = doc.text("div.mod_M h1.mall_txt"); if(title.contains("【")) title = doc.text(".mod_menu .l_f"); String director = doc.text(".jianju a"); if(director.contains("...")) director = null; String release = doc.text("li:contains(上映时间)"); if(!release.contains(" "))release = null; String verse = doc.text("li:contains(又名)"); if(verse.contains("暂无"))verse = null; String[] tags = doc.text(".mod_k a").split(":"); // 优化后的文本 title = FilterUtil.replace(title).replaceAll(" ", ""); director = FilterUtil.replace(director).replaceAll(" ", ""); release = FilterUtil.replace(release).replaceAll(" ", ""); verse = FilterUtil.replace(verse).replaceAll(" ", ""); // 封装 video.setDirector(director); video.setRelease(release); video.setTitle(title); video.setVerse(verse); List list = new ArrayList(); for(String tag : tags){ list.add(tag); } video.setTags(list); return video; } catch (Exception e) { e.printStackTrace(); } return null; } /** * 解析视频列表 * @param url * @return */ public ArrayList crawlResource(String url) { try { Cdoc doc = download(url); String next = doc.text(".page:contains(下一页)"); if(next == null){ System.err.println("已经是最末页,无法获取下一页链接"); return null; } String[] tokens = url.split("-"); String base = tokens[0]; String append = "-p-" tokens[1]; // 下一页 String nextUrl = base "/" append ".html"; System.out.println(nextUrl); nextUrl = nextUrl.replaceAll(".baidu", ""); // 集合 //List videos = new ArrayList(); ArrayList videos = new ToolCrawl().getVideoByUrl(nextUrl); for(Video video : videos){ video.setSubname(video.getTitle()); } return videos; } catch (Exception e) { e.printStackTrace(); } return null; } /** * 获取资源和播放页信息 * @param url * @return */ public ArrayList getVideoByUrl(String url) { try { ArrayList videos = new ArrayList(); Cdoc doc = download(url); String attr = ".mod_musiclist h2 a"; // 适配 if(url.contains("zyjs")){ attr = "p.mod_p a"; } String base = ""; if(url.startsWith("http://zaixian.tv")){ String[] tokens = url.split("/"); base = "http://" tokens[2]; } Elements elements = doc.select(attr); for(Element link : elements){ String linkHref = link.attr("href").trim(); String linkText = link.text().trim(); System.out.println("资源链接:" linkHref " 资源名称:" linkText); Video video = new ToolCrawl().getVideoByLink(base linkHref); videos.add(video); } return videos; } catch (Exception e) { e.printStackTrace(); } return null; } /** * 获取资源和播放页信息 * @param link * @return */ public Video getVideoByLink(String link) { try { Cdoc doc = download(link); String title = doc.text(".att_article h1"); String downlink = doc.select(".att_anchor a").get
《山形尖叫》由成海璃子 泽村一树 Akira 麻衣子 竹中直人 桐谷美玲 入江纱绫 等主演,竹中直人 导演的喜剧,恐怖电影...
免責聲明:若本站收錄的資源侵犯了您的權益,我們會及時刪除侵權內容,謝謝合作!