public String Down(int index) { String temp = WebHelper.GetHtmlCodeByWebClientWithGzip(items[index].Url, "gbk"); Document doc = NSoupClient.Parse(temp); Element script = doc.Select("body>script").First(); String target = script.OuterHtml(); String iid = WordHelper.CutWordByKeyword(target, "iid: ", ",").Trim(); return("tudou://" + iid + ":st=2/"); }
public List <BaseItem> GetList() { this.Items = new List <BaseItem>(); lists = null; String temp = WebHelper.GetHtmlCodeByWebClientWithGzip(this.Url, "gbk"); if (String.IsNullOrEmpty(temp)) { temp = WebHelper.GetHtmlCodeByWebClient(this.Url, "gbk"); } Document doc = NSoupClient.Parse(temp); Elements list = new Elements(); Elements ets = doc.Select("div.playitems"); foreach (Element et in ets) { if (et.Select("textarea.lazyContent").Count > 0) { throw new Exception("暂时不支持这种网址"); } Elements tempList = et.Select("div.pack_video_card>div.txt a"); list.AddRange(tempList); } Element scripts = doc.Select("script")[2]; this.Aid = WordHelper.CutWordByKeyword(scripts.Html(), "aid: \'", "\',"); foreach (Element item in list) { String url = item.Attr("href"); String title = item.Attr("title"); BaseItem b = new BaseItem() { Name = title, Url = url, Time = "未知", Owner = "官方" }; this.Items.Add(b); } return(this.Items); }
public bool isVaild(string url) { if (url.StartsWith("http://www.tudou.com/home/_")) { if (!url.EndsWith("/")) { url = url + "/"; } String number = WordHelper.CutWordByKeyword(url, "http://www.tudou.com/home/_", "/"); url = String.Format("http://www.tudou.com/home/item_u{0}s0p1.html", number); } if (url.StartsWith("http://www.tudou.com/home/item_") && url.EndsWith(".html")) { this.Url = url; return(true); } else { return(false); } }