void VisitWgif(HtmlElement el, HtmlElement currentEl, HtmlDocument doc) { try { ShowMsg("VisitWgif"); BdParam pm = new BdParam(); pm.q = keyword.kw; pm.rsv_xpath = "h3-a(title)"; pm.rsv_height = "107"; pm.rsv_width = "538"; pm.rsv_tpl = el.GetAttribute("tpl"); pm.p1 = el.GetAttribute("id"); pm.rsv_srcid = el.GetAttribute("srcid"); string divClickStr = el.GetAttribute("data-click"); //divClick divClick = LitJson.JsonMapper.ToObject<divClick>(divClickStr); //pm.divClick = divClick; HtmlElement h3_a = el.FirstChild.FirstChild; string h3ClickStr = h3_a.GetAttribute("data-click"); h3Click h3Click = LitJson.JsonMapper.ToObject <h3Click>(h3ClickStr); pm.h3Click = h3Click; //pm.fm = "as"; pm.rsv_sid = doc.InvokeScript("eval", new String[] { "bds.comm.sid" }).ToString(); pm.cid = "0"; pm.url = h3_a.GetAttribute("href"); pm.title = h3_a.InnerText; pm.qid = doc.InvokeScript("eval", new String[] { "bds.comm.qid" }).ToString(); pm.t = GetUNIX_TIMESTAMP().ToString(); pm.rsv_cftime = "1"; pm.rsv_iorr = "0"; pm.rsv_tn = doc.InvokeScript("eval", new String[] { "bds.comm.tn" }).ToString(); pm.rsv_isid = pm.rsv_sid; pm.rsv_ssl = "1"; pm.path = doc.Url.ToString(); pm.usburl = doc.InvokeScript("eval", new String[] { "bds.comm.ubsurl" }).ToString(); //pm.cookie = doc.Cookie; var gifAction = new Action(delegate() { HttpHelper http = new HttpHelper(); //System.Net.CookieCollection cookies = HttpHelper.StringToCookieCollection(pm.cookie, ".baidu.com"); //http.CookieContainer.Add(cookies); http.Referer = pm.path; http.Accept = "image/webp,image/*,*/*;q=0.8"; string url = string.Concat(pm.usburl, "?", pm.ToString()); ShowMsg(url); http.GetHtml(url); http = new HttpHelper(); http.Referer = pm.path; //http.CookieContainer.Add(cookies); http.GetHtml(pm.url); currentEl.SetAttribute("target", "_self"); currentEl.InvokeMember("click"); step = Step.Three; }); gifAction.BeginInvoke(null, null); } catch (Exception ex) { LogUtil.Write("VisitWgif:" + ex.Message); } }
void VisitWgif(HtmlElement el, HtmlElement currentEl, HtmlDocument doc) { try { BdParam pm = new BdParam(); pm.q = keyword; pm.rsv_xpath = "h3-a(title)"; pm.rsv_height = "107"; pm.rsv_width = "538"; pm.rsv_tpl = el.GetAttribute("tpl"); pm.p1 = el.GetAttribute("id"); pm.rsv_srcid = el.GetAttribute("srcid"); HtmlElement h3_a = el.FirstChild.FirstChild; string h3ClickStr = h3_a.GetAttribute("data-click"); h3Click h3Click = LitJson.JsonMapper.ToObject <h3Click>(h3ClickStr); pm.h3Click = h3Click; pm.rsv_sid = doc.InvokeScript("eval", new String[] { "bds.comm.sid" }).ToString(); pm.cid = "0"; pm.url = h3_a.GetAttribute("href"); pm.title = h3_a.InnerText; pm.qid = doc.InvokeScript("eval", new String[] { "bds.comm.qid" }).ToString(); pm.t = GetUNIX_TIMESTAMP().ToString(); pm.rsv_cftime = "1"; pm.rsv_iorr = "0"; pm.rsv_tn = doc.InvokeScript("eval", new String[] { "bds.comm.tn" }).ToString(); pm.rsv_isid = pm.rsv_sid; pm.rsv_ssl = "1"; pm.path = doc.Url.ToString(); pm.usburl = doc.InvokeScript("eval", new String[] { "bds.comm.ubsurl" }).ToString(); //pm.cookie = doc.Cookie; var gifAction = new Action(delegate() { currentEl.SetAttribute("target", "_self"); currentEl.InvokeMember("click"); HttpHelper http = new HttpHelper(); //System.Net.CookieCollection cookies = HttpHelper.StringToCookieCollection(pm.cookie, ".baidu.com"); //LogUtil.Write(pm.cookie); //http.CookieContainer.Add(cookies); http.Referer = pm.path; http.Accept = "image/webp,image/*,*/*;q=0.8"; string url = string.Concat(pm.usburl, "?", pm.ToString()); http.GetHtml(url); http = new HttpHelper(); //http.CookieContainer.Add(cookies); http.Referer = pm.path; url = string.Concat("https://sp2.baidu.com/8LUYsjW91Qh3otqbppnN2DJv", "?", pm.url.Substring(pm.url.IndexOf("url=")), "&cb=jQuery110207832295363147099_1465803898681&ie=utf-8&oe=utf-8&format=json&t=", GetUNIX_TIMESTAMP()); http.GetHtml(url); //http = new HttpHelper(); //http.CookieContainer.Add(cookies); //http.Referer = pm.path; //http.GetHtml(pm.url); //System.Threading.Thread.Sleep(ran.Next(1,3)*1000); //KillIe(); #if !DEBUG System.Diagnostics.Process.Start("sort1.exe"); Disconn(); //isProcess = false; #endif Application.Exit(); }); gifAction.BeginInvoke(null, null); } catch (Exception ex) { LogUtil.Write("VisitWgif:" + ex.Message); } }