/// <summary> /// http://wpa.paipai.com/pa?p=1:" + shop.qqnum + ":17 /// </summary> /// <param name="shop"></param> /// <returns></returns> public static bool IsShopOnline(PpShop shop) { string url = "http://wpa.paipai.com/pa?p=1:" + shop.qqnum + ":17"; string res1; bool isdownok = GetHTMLTCP(url, out res1); //bool isdownok = CreateGetHttpResponse(url, 5000, "", new CookieCollection(), out respone); bool online = false; if (!isdownok) { return(false); } if (res1.Contains("state_2_3")) { online = false; } else { online = true; } //Console.WriteLine("Response.IsFromCache:" + respone.ResponseUri); //Console.WriteLine("Response.IsFromCache:" + respone.IsFromCache); return(online); }
public static void PopQq(PpShop shop) { string p1 = AppDomain.CurrentDomain.BaseDirectory + "\\config\\TimwpPath.txt"; string path = FileHelper.read(p1)[0].Trim();// @"C:\Program Files (x86)\Tencent\QQ\Bin\Timwp.exe"; string par = "tencent://message/?uin=" + shop.qqnum + "&fromuserid=no&touserid=no&unionid=72000106&WebSiteName=拍拍网&Service=19&sigT=" + shop.sigT + "&sigU=" + shop.sigP; Process.Start(path, par); }
public static List <PpShop> PpShopsExtarct(string f1) { var doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(f1); //title[@lang='eng'] 选取所有 title 元素,且这些元素拥有值为 eng 的 lang 属性。 var alist = doc.DocumentNode.SelectNodes("//li[@class='item-attr-list'] "); //item-attr-list if (alist == null) { return(new List <PpShop>()); } Console.WriteLine(alist.Elements().Count()); List <PpShop> shops = new List <PpShop>(); int index = 0; foreach (var htmlNode in alist) { PpShop ppShop = new PpShop(); ppShop.index = index; index++; var titile = htmlNode.SelectNodes("ul[1]/li[2]/div/dl/dt/h3/a"); ppShop.titile = titile[0].InnerText; ppShop.mainseller_sell = htmlNode.SelectNodes("ul/li[2]/div/dl/div[1]/p[1]/span[2]")[0].InnerText; ppShop.mainseller_owner = htmlNode.SelectNodes("ul/li[2]/div/dl/div[1]/p[2]/a")[0].InnerText; //imtalk ppShop.imtakStr = htmlNode.SelectNodes("ul/li[2]/div/dl/div[2]/ul/li[1]/q/a")[0].GetAttributeValue("href", ""); // ppShop.como_num = htmlNode.SelectNodes("ul[1]/li[3]/dl/dd")[0].InnerText; //legend ppShop.legend = htmlNode.SelectNodes("ul[1]/li[4]/dl/dd/label")[0].InnerText; //promotions ppShop.promotions = htmlNode.SelectNodes("ul[1]/li[5]/dl")[0].InnerText; //adress ppShop.adress = htmlNode.SelectNodes("ul[1]/li[6]")[0].InnerText; ////*[@id="itemList"]/ul[1]/li/ul/li[2]/div/dl/div[2]/ul/li[1]/q/a shops.Add(ppShop); } return(shops); }
public static bool IsShopOnline(WebClient webClient, PpShop shop) { var hwr = HttpWebRequest.Create("http://wpa.paipai.com/pa?p=1:" + shop.qqnum + ":17"); hwr.Timeout = 1000; var Response = hwr.GetResponse(); var responseUrl = Response.ResponseUri.ToString(); bool online = false; if (responseUrl.Contains("state_2_3")) { online = false; } else { online = true; } Console.WriteLine("Response.IsFromCache:" + Response.IsFromCache); return(online); }