private Movie extractMovieParidise(string link) { var parameter = new DownloadParamers(link); var page = new Downloader().DownLoad(parameter, Encoding.GetEncoding("gb2312")); if (page == null) { return(null); } var parser = new HtmlParser(); var root = parser.Parse(page); var titles = root.GetAllChildrenByElementType(Jasmine.Parsers.Html.ElementType.Title); var title = string.Empty; if (titles.Count != 0) { title = titles[0].InnerText.Replace("迅雷下载_电影天堂", ""); } foreach (var item in root.GetAll(x => x.TagName == "tbody")) { foreach (var a in item.GetAll(x => x.TagName == "a")) { if (a.Attributes.Contains("href") /*item.Attributes["href"]=="#"&&*//*item.Attributes.Contains("target")*//*&&item.Attributes["target"]=="self"*/) { var moive = new Movie() { Name = title, Link = a.InnerText, Site = "www.dytt8.net" }; return(moive); } } } return(null); }
private void run(string name, string key, Action <string, Movie> onFind) { Task.Run(() => { var parameter = new DownloadParamers($"https://www.baidu.com/s?wd={name}"); var baiduPage = new Downloader().DownLoad(parameter, Encoding.UTF8); foreach (var item in getBaiduLinks(baiduPage)) { findMovie(item, key, onFind); } }); }
private Movie[] extractLol(string link) { var parameter = new DownloadParamers(link); var page = new Downloader().DownLoad(parameter, Encoding.GetEncoding("gb2312")); var ls = new List <Movie>(); if (page == null) { return(null); } var parser = new HtmlParser(); var root = parser.Parse(page); var titles = root.GetAllChildrenByElementType(Jasmine.Parsers.Html.ElementType.Title); var title = string.Empty; if (titles.Count != 0) { title = titles[0].InnerText.Replace("迅雷下载-LOL电影天堂", ""); } foreach (var ul in root.GetAll(x => x.TagName == "ul" && x.Attributes.Contains("class") && x.Attributes["class"] == "downurl")) { foreach (var item in ul.GetAll(x => x.TagName == "a" && x.Attributes.Contains("href"))) { ls.Add(new Movie() { Name = title, Link = item.Attributes["href"], Site = "www.loldyttw.com" }); } } return(ls.ToArray()); }
private void findMovie(string link, string key, Action <string, Movie> onFind) { Task.Run(() => { var parameter = new DownloadParamers(link); var page = new Downloader().DownLoad(parameter, Encoding.UTF8); if (page != null) { var movies = ExtractMovie(link, page); if (movies != null) { foreach (var item in movies) { onFind(key, item); } } } }); }