程序分析
1 public void GetGjcList(object value) 2 { 3 try 4 { 5 string htmlString; 6 HtmlNode node4; 7 string innerHtml; 8 string[] strArray = ConvertHelper.GetString(value).Split(new string[] { "&*&" }, StringSplitOptions.None); 9 string str = strArray[0].ToString(); 10 string str3 = strArray[1].ToString(); 11 string url = ""; 12 switch (str3) 13 { 14 case "默认": 15 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&tab=all&s="; 16 break; 17 18 case "人气": 19 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&sort=renqi-desc&s="; 20 break; 21 22 case "销量": 23 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&sort=sale-desc&s="; 24 break; 25 } 26 string str5 = ""; 27 try 28 { 29 htmlString = GetHtmlString(url); 30 } 31 catch 32 { 33 } 34 HtmlDocument document = new HtmlDocument(); 35 document.LoadHtml(GetHtmlString(url)); 36 HtmlNode documentNode = document.DocumentNode; 37 HtmlNode node2 = documentNode.SelectSingleNode("//div[@class='combobar-copy row']"); 38 if ((node2 != null) && (node2.InnerText.IndexOf("所有宝贝") > -1)) 39 { 40 url = "http://s.taobao.com" + node2.SelectSingleNode("./div/a").Attributes["href"].Value; 41 switch (str3) 42 { 43 case "默认": 44 url = url + "&s="; 45 break; 46 47 case "人气": 48 url = url + "&sort=renqi-desc&s="; 49 break; 50 51 case "销量": 52 url = url + "&sort=sale-desc&s="; 53 break; 54 } 55 HtmlDocument document2 = new HtmlDocument(); 56 document2.LoadHtml(GetHtmlString(url)); 57 node4 = document2.DocumentNode.SelectSingleNode("//div[@class='page-top']"); 58 if ((node4 != null) && (node4.InnerHtml.IndexOf("bcoffset=") > -1)) 59 { 60 innerHtml = node4.InnerHtml; 61 str5 = innerHtml.Substring(innerHtml.IndexOf("bcoffset="), 10); 62 } 63 } 64 else 65 { 66 node4 = documentNode.SelectSingleNode("//div[@class='page-top']"); 67 if ((node4 != null) && (node4.InnerHtml.IndexOf("bcoffset=") > -1)) 68 { 69 innerHtml = node4.InnerHtml; 70 str5 = innerHtml.Substring(innerHtml.IndexOf("bcoffset="), 10); 71 } 72 } 73 int integer = ConvertHelper.GetInteger(strArray[2]); 74 int num2 = ConvertHelper.GetInteger(strArray[3]); 75 int num3 = 0; 76 int num4 = 0x3e8; 77 int num5 = 0; 78 string str8 = "0"; 79 double num6 = 0.0; 80 double num7 = 1000.0; 81 double num8 = 0.0; 82 double num9 = 100.0; 83 double num10 = 0.0; 84 double num11 = 5.0; 85 double num12 = 0.0; 86 double num13 = 5.0; 87 double num14 = 0.0; 88 double num15 = 5.0; 89 double num16 = 0.0; 90 double num17 = 0.0; 91 double num18 = 0.0; 92 double num19 = 0.0; 93 double num20 = 0.0; 94 double num21 = 0.0; 95 double num22 = 0.0; 96 int num23 = 0; 97 for (int i = integer; i <= num2; i++) 98 { 99 this.manualReset_Gjc.WaitOne(); 100 if (this.StopTh_Gjc == 0) 101 { 102 break; 103 } 104 htmlString = GetHtmlString((url + ((i - 1) * 40)) + "&" + str5 + "&promote=0#J_relative"); 105 if ((str8 == "0") && ((htmlString != "") && (htmlString.IndexOf("</span> 件宝贝") > -1))) 106 { 107 string str10 = htmlString.Split(new string[] { "</span> 件宝贝" }, StringSplitOptions.None)[0]; 108 str8 = str10.Substring(str10.LastIndexOf(">") + 1); 109 } 110 if ((htmlString != "") && (htmlString.IndexOf("<div class=\"col item icon-datalink\"") > -1)) 111 { 112 string[] strArray2 = htmlString.Split(new string[] { "<div class=\"col item icon-datalink\"" }, StringSplitOptions.None); 113 for (int j = 1; j < strArray2.Length; j++) 114 { 115 this.manualReset_Gjc.WaitOne(); 116 if (this.StopTh_Gjc == 0) 117 { 118 break; 119 } 120 try 121 { 122 string str33; 123 DateTime dateTime; 124 TimeSpan span; 125 this.gjcxuhaoInt++; 126 string strValue = strArray2[j]; 127 string itemid = strValue.Substring(strValue.IndexOf("nid=\"") + 5, strValue.IndexOf("\" >") - (strValue.IndexOf("nid=\"") + 5)); 128 string str13 = strValue.Split(new string[] { "<span class=\"J_WangWang\"" }, StringSplitOptions.None)[1]; 129 string str14 = str13.Substring(str13.IndexOf("data-nick=\"") + 11, str13.IndexOf("\" data-display") - (str13.IndexOf("data-nick=\"") + 11)); 130 string gjcTsfw = this.ReTsfw(strValue); 131 string gjcBC = ""; 132 string gjcXinyu = ""; 133 string str18 = ""; 134 string str20 = GetHtmlString("http://item.taobao.com/item.htm?id=" + itemid); 135 if (str20.IndexOf("<title>") > -1) 136 { 137 str18 = str20.Substring(str20.IndexOf("<title>") + 7, str20.IndexOf("</title>") - (str20.IndexOf("<title>") + 7)); 138 if (str18.IndexOf("-tmall.com天猫") > -1) 139 { 140 str18 = str18.Substring(0, str18.IndexOf("-tmall.com天猫")); 141 gjcBC = "商城"; 142 gjcXinyu = "天猫"; 143 } 144 if (str18.IndexOf("-淘宝网") > -1) 145 { 146 str18 = str18.Substring(0, str18.IndexOf("-淘宝网")); 147 gjcBC = "C店"; 148 if (str20.IndexOf("/newrank/") > -1) 149 { 150 string str21 = str20.Split(new string[] { "/newrank/" }, StringSplitOptions.None)[1]; 151 string x = str21.Substring(0, str21.IndexOf(".gif")); 152 gjcXinyu = this.creditnums(x); 153 } 154 else 155 { 156 gjcXinyu = "未知"; 157 } 158 } 159 } 160 string gjcBbName = str18; 161 string gjcBbID = ""; 162 string gjcBbPic = ""; 163 string gjcwangw = ""; 164 string gjcwangID = ""; 165 string gjcBbLm = ""; 166 string gjcdlistWeek = ""; 167 string gjcdlistDate = ""; 168 string gjcdlistSyTime = ""; 169 if (str20.IndexOf("&ends=") > -1) 170 { 171 string strTime = str20.Substring(str20.IndexOf("&ends=") + 6, 10); 172 str33 = this.getUNIXTime(strTime).ToString(); 173 if (str33 != "") 174 { 175 dateTime = ConvertHelper.GetDateTime(str33); 176 gjcdlistWeek = this.ChineseByEnWeek(dateTime.DayOfWeek.ToString()); 177 gjcdlistDate = str33; 178 span = (TimeSpan) (dateTime - ConvertHelper.GetDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); 179 gjcdlistSyTime = span.Days.ToString() + "天" + span.Hours.ToString() + "时" + span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒"; 180 } 181 } 182 else 183 { 184 str33 = this.RedelistTime(itemid); 185 if (str33 != "") 186 { 187 dateTime = ConvertHelper.GetDateTime(str33); 188 gjcdlistWeek = this.ChineseByEnWeek(dateTime.DayOfWeek.ToString()); 189 gjcdlistDate = str33; 190 span = (TimeSpan) (dateTime - DateTime.Now); 191 gjcdlistSyTime = span.Days.ToString() + "天" + span.Hours.ToString() + "时" + span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒"; 192 } 193 } 194 string gjcBrowse = ""; 195 string gjcCollect = ""; 196 double gjcOldPrice = 0.0; 197 double gjcNowPrice = 0.0; 198 double gjczhekou = 0.0; 199 double gjcPostage = 0.0; 200 int gjcCjlThree = 0; 201 int gjcYetEvaluate = 0; 202 double gjcGoodEvaluate = 0.0; 203 double gjcMiaosCode = 0.0; 204 double gjcFuwuCode = 0.0; 205 double gjcFahuoCode = 0.0; 206 double gjcPjRefund = 0.0; 207 double num37 = 0.0; 208 double gjcThreeRefund = 0.0; 209 double num39 = 0.0; 210 double gjcThreeComplain = 0.0; 211 double num41 = 0.0; 212 string gjcArea = ""; 213 string gjcSearchTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); 214 string str38 = "http://list.taobao.com/itemlist/default.htm?ratesumto=20&cat=0&nick=" + str14 + "&fromPage=adSearch&q=" + HttpUtility.UrlEncode(str18, Encoding.GetEncoding("utf-8")) + "&ratesumfrom=0&viewIndex=1&_input_charset=utf-8&json=on&pSize=95"; 215 string str39 = GetHtmlString(str38); 216 if (str39.IndexOf("\"mallItemList\"") == -1) 217 { 218 int num42 = 5; 219 while (num42 > 0) 220 { 221 if (str39.IndexOf("\"mallItemList\"") == -1) 222 { 223 Thread.Sleep(10); 224 str39 = GetHtmlString1(str38); 225 } 226 else 227 { 228 break; 229 } 230 } 231 } 232 if (str39.IndexOf("\"mallItemList\"") > -1) 233 { 234 if (str39.IndexOf("\"catList\"") > -1) 235 { 236 string str40 = str39.Split(new string[] { "\"catList\"" }, StringSplitOptions.None)[1]; 237 string str41 = str40.Split(new string[] { "\"name\"" }, StringSplitOptions.None)[1]; 238 gjcBbLm = str41.Substring(str41.IndexOf("\"") + 1, str41.IndexOf("\",") - (str41.IndexOf("\"") + 1)) + "-" + str; 239 } 240 string str42 = ""; 241 if (str39.IndexOf("\"mallItemList\":null") > -1) 242 { 243 str42 = str39.Split(new string[] { "\"itemList\"" }, StringSplitOptions.None)[1]; 244 } 245 else 246 { 247 str42 = str39.Split(new string[] { "\"mallItemList\"" }, StringSplitOptions.None)[1]; 248 } 249 gjcBbPic = str42.Split(new string[] { "\"image\"" }, StringSplitOptions.None)[1]; 250 gjcBbPic = gjcBbPic.Substring(gjcBbPic.IndexOf("\"") + 1, gjcBbPic.IndexOf("\",") - (gjcBbPic.IndexOf("\"") + 1)); 251 string str43 = str42.Split(new string[] { "\"price\"" }, StringSplitOptions.None)[1]; 252 gjcOldPrice = ConvertHelper.GetDouble(str43.Substring(str43.IndexOf("\"") + 1, str43.IndexOf("\",") - (str43.IndexOf("\"") + 1))); 253 string str44 = str42.Split(new string[] { "\"currentPrice\"" }, StringSplitOptions.None)[1]; 254 gjcNowPrice = ConvertHelper.GetDouble(str44.Substring(str44.IndexOf("\"") + 1, str44.IndexOf("\",") - (str44.IndexOf("\"") + 1))); 255 if (num6 < gjcNowPrice) 256 { 257 num6 = gjcNowPrice; 258 } 259 if (num7 > gjcNowPrice) 260 { 261 num7 = gjcNowPrice; 262 } 263 num8 += gjcNowPrice; 264 if (!(gjcOldPrice == 0.0)) 265 { 266 gjczhekou = Math.Round((double) (gjcNowPrice / gjcOldPrice), 2); 267 } 268 string str45 = str42.Split(new string[] { "\"ship\"" }, StringSplitOptions.None)[1]; 269 gjcPostage = ConvertHelper.GetDouble(str45.Substring(str45.IndexOf("\"") + 1, str45.IndexOf("\",") - (str45.IndexOf("\"") + 1))); 270 string str46 = str42.Split(new string[] { "\"tradeNum\"" }, StringSplitOptions.None)[1]; 271 gjcCjlThree = ConvertHelper.GetInteger(str46.Substring(str46.IndexOf("\"") + 1, str46.IndexOf("\",") - (str46.IndexOf("\"") + 1))); 272 if (gjcCjlThree > num3) 273 { 274 num3 = gjcCjlThree; 275 } 276 if (num4 > gjcCjlThree) 277 { 278 num4 = gjcCjlThree; 279 } 280 num5 += gjcCjlThree; 281 string str47 = str42.Split(new string[] { "\"commend\"" }, StringSplitOptions.None)[1]; 282 gjcYetEvaluate = ConvertHelper.GetInteger(str47.Substring(str47.IndexOf("\"") + 1, str47.IndexOf("\",") - (str47.IndexOf("\"") + 1))); 283 string str48 = str42.Split(new string[] { "\"nick\"" }, StringSplitOptions.None)[1]; 284 gjcwangw = str48.Substring(str48.IndexOf("\"") + 1, str48.IndexOf("\",") - (str48.IndexOf("\"") + 1)); 285 string str49 = str42.Split(new string[] { "\"sellerId\"" }, StringSplitOptions.None)[1]; 286 gjcwangID = str49.Substring(str49.IndexOf("\"") + 1, str49.IndexOf("\",") - (str49.IndexOf("\"") + 1)); 287 string str50 = str42.Split(new string[] { "\"itemId\"" }, StringSplitOptions.None)[1]; 288 gjcBbID = str50.Substring(str50.IndexOf("\"") + 1, str50.IndexOf("\",") - (str50.IndexOf("\"") + 1)); 289 string str52 = GetHtmlString1("http://count.tbcdn.cn/counter3?keys=ICVT_7_" + gjcBbID + ",ICCP_1_" + gjcBbID + "&callback=a"); 290 if ((str52 != "") && (str52.IndexOf("ICVT_7_") > -1)) 291 { 292 string str53 = str52.Split(new string[] { "ICVT_7_" }, StringSplitOptions.None)[1]; 293 if (str53.IndexOf(",") > -1) 294 { 295 if (gjcBC == "商城") 296 { 297 gjcBrowse = "----"; 298 } 299 else 300 { 301 gjcBrowse = str53.Substring(str53.IndexOf("\":") + 2, str53.IndexOf(",") - (str53.IndexOf("\":") + 2)); 302 } 303 } 304 else if (gjcBC == "商城") 305 { 306 gjcBrowse = "----"; 307 } 308 else 309 { 310 gjcBrowse = str53.Substring(str53.IndexOf("\":") + 2, str53.IndexOf("}") - (str53.IndexOf("\":") + 2)); 311 } 312 } 313 if ((str52 != "") && (str52.IndexOf("ICCP_1_") > -1)) 314 { 315 string str54 = str52.Split(new string[] { "ICCP_1_" }, StringSplitOptions.None)[1]; 316 if (str54.IndexOf(",") > -1) 317 { 318 gjcCollect = str54.Substring(str54.IndexOf("\":") + 2, str54.IndexOf(",") - (str54.IndexOf("\":") + 2)); 319 } 320 else 321 { 322 gjcCollect = str54.Substring(str54.IndexOf("\":") + 2, str54.IndexOf("}") - (str54.IndexOf("\":") + 2)); 323 } 324 } 325 string str56 = GetHtmlString("http://s.taobao.com/interfaces/shop_dsr.php?user_id=" + gjcwangID); 326 if ((str56 != "") && (str56.IndexOf("sgr") > -1)) 327 { 328 string str57 = str56.Split(new string[] { "\"sgr\"" }, StringSplitOptions.None)[1]; 329 gjcGoodEvaluate = ConvertHelper.GetDouble(str57.Substring(str57.IndexOf("\"") + 1, str57.IndexOf("%") - (str57.IndexOf("\"") + 1))); 330 if (num9 > gjcGoodEvaluate) 331 { 332 num9 = gjcGoodEvaluate; 333 } 334 num10 += gjcGoodEvaluate; 335 } 336 if ((str56 != "") && (str56.IndexOf("mas") > -1)) 337 { 338 string str58 = str56.Split(new string[] { "\"mas\"" }, StringSplitOptions.None)[1]; 339 gjcMiaosCode = ConvertHelper.GetDouble(str58.Substring(str58.IndexOf("\"") + 1, str58.IndexOf("\",") - (str58.IndexOf("\"") + 1))); 340 if (num11 > gjcMiaosCode) 341 { 342 num11 = gjcMiaosCode; 343 } 344 num12 += gjcMiaosCode; 345 } 346 if ((str56 != "") && (str56.IndexOf("sas") > -1)) 347 { 348 string str59 = str56.Split(new string[] { "\"sas\"" }, StringSplitOptions.None)[1]; 349 gjcFuwuCode = ConvertHelper.GetDouble(str59.Substring(str59.IndexOf("\"") + 1, str59.IndexOf("\",") - (str59.IndexOf("\"") + 1))); 350 if (num13 > gjcFuwuCode) 351 { 352 num13 = gjcFuwuCode; 353 } 354 num14 += gjcFuwuCode; 355 } 356 if ((str56 != "") && (str56.IndexOf("cas") > -1)) 357 { 358 string str60 = str56.Split(new string[] { "\"cas\"" }, StringSplitOptions.None)[1]; 359 gjcFahuoCode = ConvertHelper.GetDouble(str60.Substring(str60.IndexOf("\"") + 1, str60.IndexOf("\",") - (str60.IndexOf("\"") + 1))); 360 if (num15 > gjcFahuoCode) 361 { 362 num15 = gjcFahuoCode; 363 } 364 num16 += gjcFahuoCode; 365 } 366 string str62 = GetHtmlString("http://rate.taobao.com/ShopService4C.htm?userNumId=" + gjcwangID); 367 if ((str62 != "") && (str62.IndexOf("avgRefund") > -1)) 368 { 369 string str63 = str62.Substring(str62.IndexOf("avgRefund"), str62.IndexOf("punish") - str62.IndexOf("avgRefund")); 370 string str64 = str63.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 371 gjcPjRefund = ConvertHelper.GetDouble(str64.Substring(str64.IndexOf("\"") + 1, str64.IndexOf("\"}") - (str64.IndexOf("\"") + 1))); 372 string str65 = str63.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 373 num37 = ConvertHelper.GetDouble(str65.Substring(str65.IndexOf("\"") + 1, str65.IndexOf("\",") - (str65.IndexOf("\"") + 1))); 374 if (num17 < gjcPjRefund) 375 { 376 num17 = gjcPjRefund; 377 } 378 num18 = num37; 379 } 380 if ((str62 != "") && (str62.IndexOf("ratRefund") > -1)) 381 { 382 string str66 = str62.Substring(str62.IndexOf("ratRefund"), str62.IndexOf("complaints") - str62.IndexOf("ratRefund")); 383 string str67 = str66.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 384 gjcThreeRefund = ConvertHelper.GetDouble(str67.Substring(str67.IndexOf("\"") + 1, str67.IndexOf("\",") - (str67.IndexOf("\"") + 1))); 385 string str68 = str66.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 386 num39 = ConvertHelper.GetDouble(str68.Substring(str68.IndexOf("\"") + 1, str68.IndexOf("\",") - (str68.IndexOf("\"") + 1))); 387 if (num19 < gjcThreeRefund) 388 { 389 num19 = gjcThreeRefund; 390 } 391 num20 = num39; 392 } 393 if ((str62 != "") && (str62.IndexOf("complaints") > -1)) 394 { 395 string str69 = str62.Substring(str62.IndexOf("complaints")); 396 string str70 = str69.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 397 gjcThreeComplain = ConvertHelper.GetDouble(str70.Substring(str70.IndexOf("\"") + 1, str70.IndexOf("\",") - (str70.IndexOf("\"") + 1))); 398 string str71 = str69.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 399 num41 = ConvertHelper.GetDouble(str71.Substring(str71.IndexOf("\"") + 1, str71.IndexOf("\",") - (str71.IndexOf("\"") + 1))); 400 if (num21 < gjcThreeComplain) 401 { 402 num21 = gjcThreeComplain; 403 } 404 num22 = num41; 405 } 406 num23++; 407 string str72 = str42.Split(new string[] { "\"loc\"" }, StringSplitOptions.None)[1]; 408 gjcArea = str72.Substring(str72.IndexOf("\"") + 1, str72.IndexOf("\",") - (str72.IndexOf("\"") + 1)); 409 } 410 string gjcpm = j.ToString() + "位/" + i.ToString() + "页"; 411 this.SaveGjcTable(this.gjcxuhaoInt, gjcpm, gjcBbName, gjcBbID, gjcBbPic, gjcwangw, gjcwangID, gjcCjlThree, gjcdlistWeek, gjcdlistDate, gjcdlistSyTime, gjcBrowse, gjcCollect, gjcOldPrice, gjcNowPrice, gjczhekou, gjcPostage, gjcYetEvaluate, gjcGoodEvaluate, gjcMiaosCode, gjcFuwuCode, gjcFahuoCode, gjcPjRefund, gjcThreeRefund, gjcThreeComplain, gjcTsfw, gjcBC, gjcXinyu, gjcBbLm, gjcArea, gjcSearchTime); 412 if (base.InvokeRequired) 413 { 414 base.Invoke(new DeleGjcAddIng(this.GjcAddIng), new object[] { 415 this.gjcxuhaoInt, gjcpm, gjcBbName, gjcBbID, gjcBbPic, gjcwangw, gjcwangID, gjcCjlThree, gjcdlistWeek, gjcdlistDate, gjcdlistSyTime, gjcBrowse, gjcCollect, gjcOldPrice, gjcNowPrice, gjczhekou, 416 gjcPostage, gjcYetEvaluate, gjcGoodEvaluate, gjcMiaosCode, gjcFuwuCode, gjcFahuoCode, gjcPjRefund, gjcThreeRefund, gjcThreeComplain, gjcTsfw, gjcBC, gjcXinyu, gjcBbLm, gjcArea, gjcSearchTime 417 }); 418 } 419 } 420 catch (Exception) 421 { 422 } 423 } 424 } 425 } 426 if (base.InvokeRequired) 427 { 428 base.Invoke(new DeleGjcZSCom(this.GjcZSCom), new object[] { 429 num3, num4, num5, str8, num6, num7, num8, num9, num10, num11, num12, num13, num14, num15, num16, num17, 430 num18, num19, num20, num21, num22, num23 431 }); 432 } 433 if (base.InvokeRequired) 434 { 435 base.Invoke(new DeleGjcCom(this.GjcCom)); 436 } 437 } 438 catch 439 { 440 } 441 if (base.InvokeRequired) 442 { 443 base.Invoke(new DeleGjcCom(this.GjcCom)); 444 } 445 } 446 447 448 449 450 public void GetGjcList(object value) 451 { 452 try 453 { 454 string htmlString; 455 HtmlNode node4; 456 string innerHtml; 457 string[] strArray = ConvertHelper.GetString(value).Split(new string[] { "&*&" }, StringSplitOptions.None); 458 string str = strArray[0].ToString(); 459 string str3 = strArray[1].ToString(); 460 string url = ""; 461 switch (str3) 462 { 463 case "默认": 464 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&tab=all&s="; 465 break; 466 467 case "人气": 468 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&sort=renqi-desc&s="; 469 break; 470 471 case "销量": 472 url = "http://s.taobao.com/search?q=" + HttpUtility.UrlEncode(str, Encoding.GetEncoding("gb2312")) + "&tab=all&style=grid&initiative_id=tbindexz_" + this.splitString1(DateTime.Now) + "&sort=sale-desc&s="; 473 break; 474 } 475 string str5 = ""; 476 try 477 { 478 htmlString = GetHtmlString(url); 479 } 480 catch 481 { 482 } 483 HtmlDocument document = new HtmlDocument(); 484 document.LoadHtml(GetHtmlString(url)); 485 HtmlNode documentNode = document.DocumentNode; 486 HtmlNode node2 = documentNode.SelectSingleNode("//div[@class='combobar-copy row']"); 487 if ((node2 != null) && (node2.InnerText.IndexOf("所有宝贝") > -1)) 488 { 489 url = "http://s.taobao.com" + node2.SelectSingleNode("./div/a").Attributes["href"].Value; 490 switch (str3) 491 { 492 case "默认": 493 url = url + "&s="; 494 break; 495 496 case "人气": 497 url = url + "&sort=renqi-desc&s="; 498 break; 499 500 case "销量": 501 url = url + "&sort=sale-desc&s="; 502 break; 503 } 504 HtmlDocument document2 = new HtmlDocument(); 505 document2.LoadHtml(GetHtmlString(url)); 506 node4 = document2.DocumentNode.SelectSingleNode("//div[@class='page-top']"); 507 if ((node4 != null) && (node4.InnerHtml.IndexOf("bcoffset=") > -1)) 508 { 509 innerHtml = node4.InnerHtml; 510 str5 = innerHtml.Substring(innerHtml.IndexOf("bcoffset="), 10); 511 } 512 } 513 else 514 { 515 node4 = documentNode.SelectSingleNode("//div[@class='page-top']"); 516 if ((node4 != null) && (node4.InnerHtml.IndexOf("bcoffset=") > -1)) 517 { 518 innerHtml = node4.InnerHtml; 519 str5 = innerHtml.Substring(innerHtml.IndexOf("bcoffset="), 10); 520 } 521 } 522 int integer = ConvertHelper.GetInteger(strArray[2]); 523 int num2 = ConvertHelper.GetInteger(strArray[3]); 524 int num3 = 0; 525 int num4 = 0x3e8; 526 int num5 = 0; 527 string str8 = "0"; 528 double num6 = 0.0; 529 double num7 = 1000.0; 530 double num8 = 0.0; 531 double num9 = 100.0; 532 double num10 = 0.0; 533 double num11 = 5.0; 534 double num12 = 0.0; 535 double num13 = 5.0; 536 double num14 = 0.0; 537 double num15 = 5.0; 538 double num16 = 0.0; 539 double num17 = 0.0; 540 double num18 = 0.0; 541 double num19 = 0.0; 542 double num20 = 0.0; 543 double num21 = 0.0; 544 double num22 = 0.0; 545 int num23 = 0; 546 for (int i = integer; i <= num2; i++) 547 { 548 this.manualReset_Gjc.WaitOne(); 549 if (this.StopTh_Gjc == 0) 550 { 551 break; 552 } 553 htmlString = GetHtmlString((url + ((i - 1) * 40)) + "&" + str5 + "&promote=0#J_relative"); 554 if ((str8 == "0") && ((htmlString != "") && (htmlString.IndexOf("</span> 件宝贝") > -1))) 555 { 556 string str10 = htmlString.Split(new string[] { "</span> 件宝贝" }, StringSplitOptions.None)[0]; 557 str8 = str10.Substring(str10.LastIndexOf(">") + 1); 558 } 559 if ((htmlString != "") && (htmlString.IndexOf("<div class=\"col item icon-datalink\"") > -1)) 560 { 561 string[] strArray2 = htmlString.Split(new string[] { "<div class=\"col item icon-datalink\"" }, StringSplitOptions.None); 562 for (int j = 1; j < strArray2.Length; j++) 563 { 564 this.manualReset_Gjc.WaitOne(); 565 if (this.StopTh_Gjc == 0) 566 { 567 break; 568 } 569 try 570 { 571 string str33; 572 DateTime dateTime; 573 TimeSpan span; 574 this.gjcxuhaoInt++; 575 string strValue = strArray2[j]; 576 string itemid = strValue.Substring(strValue.IndexOf("nid=\"") + 5, strValue.IndexOf("\" >") - (strValue.IndexOf("nid=\"") + 5)); 577 string str13 = strValue.Split(new string[] { "<span class=\"J_WangWang\"" }, StringSplitOptions.None)[1]; 578 string str14 = str13.Substring(str13.IndexOf("data-nick=\"") + 11, str13.IndexOf("\" data-display") - (str13.IndexOf("data-nick=\"") + 11)); 579 string gjcTsfw = this.ReTsfw(strValue); 580 string gjcBC = ""; 581 string gjcXinyu = ""; 582 string str18 = ""; 583 string str20 = GetHtmlString("http://item.taobao.com/item.htm?id=" + itemid); 584 if (str20.IndexOf("<title>") > -1) 585 { 586 str18 = str20.Substring(str20.IndexOf("<title>") + 7, str20.IndexOf("</title>") - (str20.IndexOf("<title>") + 7)); 587 if (str18.IndexOf("-tmall.com天猫") > -1) 588 { 589 str18 = str18.Substring(0, str18.IndexOf("-tmall.com天猫")); 590 gjcBC = "商城"; 591 gjcXinyu = "天猫"; 592 } 593 if (str18.IndexOf("-淘宝网") > -1) 594 { 595 str18 = str18.Substring(0, str18.IndexOf("-淘宝网")); 596 gjcBC = "C店"; 597 if (str20.IndexOf("/newrank/") > -1) 598 { 599 string str21 = str20.Split(new string[] { "/newrank/" }, StringSplitOptions.None)[1]; 600 string x = str21.Substring(0, str21.IndexOf(".gif")); 601 gjcXinyu = this.creditnums(x); 602 } 603 else 604 { 605 gjcXinyu = "未知"; 606 } 607 } 608 } 609 string gjcBbName = str18; 610 string gjcBbID = ""; 611 string gjcBbPic = ""; 612 string gjcwangw = ""; 613 string gjcwangID = ""; 614 string gjcBbLm = ""; 615 string gjcdlistWeek = ""; 616 string gjcdlistDate = ""; 617 string gjcdlistSyTime = ""; 618 if (str20.IndexOf("&ends=") > -1) 619 { 620 string strTime = str20.Substring(str20.IndexOf("&ends=") + 6, 10); 621 str33 = this.getUNIXTime(strTime).ToString(); 622 if (str33 != "") 623 { 624 dateTime = ConvertHelper.GetDateTime(str33); 625 gjcdlistWeek = this.ChineseByEnWeek(dateTime.DayOfWeek.ToString()); 626 gjcdlistDate = str33; 627 span = (TimeSpan) (dateTime - ConvertHelper.GetDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); 628 gjcdlistSyTime = span.Days.ToString() + "天" + span.Hours.ToString() + "时" + span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒"; 629 } 630 } 631 else 632 { 633 str33 = this.RedelistTime(itemid); 634 if (str33 != "") 635 { 636 dateTime = ConvertHelper.GetDateTime(str33); 637 gjcdlistWeek = this.ChineseByEnWeek(dateTime.DayOfWeek.ToString()); 638 gjcdlistDate = str33; 639 span = (TimeSpan) (dateTime - DateTime.Now); 640 gjcdlistSyTime = span.Days.ToString() + "天" + span.Hours.ToString() + "时" + span.Minutes.ToString() + "分" + span.Seconds.ToString() + "秒"; 641 } 642 } 643 string gjcBrowse = ""; 644 string gjcCollect = ""; 645 double gjcOldPrice = 0.0; 646 double gjcNowPrice = 0.0; 647 double gjczhekou = 0.0; 648 double gjcPostage = 0.0; 649 int gjcCjlThree = 0; 650 int gjcYetEvaluate = 0; 651 double gjcGoodEvaluate = 0.0; 652 double gjcMiaosCode = 0.0; 653 double gjcFuwuCode = 0.0; 654 double gjcFahuoCode = 0.0; 655 double gjcPjRefund = 0.0; 656 double num37 = 0.0; 657 double gjcThreeRefund = 0.0; 658 double num39 = 0.0; 659 double gjcThreeComplain = 0.0; 660 double num41 = 0.0; 661 string gjcArea = ""; 662 string gjcSearchTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); 663 string str38 = "http://list.taobao.com/itemlist/default.htm?ratesumto=20&cat=0&nick=" + str14 + "&fromPage=adSearch&q=" + HttpUtility.UrlEncode(str18, Encoding.GetEncoding("utf-8")) + "&ratesumfrom=0&viewIndex=1&_input_charset=utf-8&json=on&pSize=95"; 664 string str39 = GetHtmlString(str38); 665 if (str39.IndexOf("\"mallItemList\"") == -1) 666 { 667 int num42 = 5; 668 while (num42 > 0) 669 { 670 if (str39.IndexOf("\"mallItemList\"") == -1) 671 { 672 Thread.Sleep(10); 673 str39 = GetHtmlString1(str38); 674 } 675 else 676 { 677 break; 678 } 679 } 680 } 681 if (str39.IndexOf("\"mallItemList\"") > -1) 682 { 683 if (str39.IndexOf("\"catList\"") > -1) 684 { 685 string str40 = str39.Split(new string[] { "\"catList\"" }, StringSplitOptions.None)[1]; 686 string str41 = str40.Split(new string[] { "\"name\"" }, StringSplitOptions.None)[1]; 687 gjcBbLm = str41.Substring(str41.IndexOf("\"") + 1, str41.IndexOf("\",") - (str41.IndexOf("\"") + 1)) + "-" + str; 688 } 689 string str42 = ""; 690 if (str39.IndexOf("\"mallItemList\":null") > -1) 691 { 692 str42 = str39.Split(new string[] { "\"itemList\"" }, StringSplitOptions.None)[1]; 693 } 694 else 695 { 696 str42 = str39.Split(new string[] { "\"mallItemList\"" }, StringSplitOptions.None)[1]; 697 } 698 gjcBbPic = str42.Split(new string[] { "\"image\"" }, StringSplitOptions.None)[1]; 699 gjcBbPic = gjcBbPic.Substring(gjcBbPic.IndexOf("\"") + 1, gjcBbPic.IndexOf("\",") - (gjcBbPic.IndexOf("\"") + 1)); 700 string str43 = str42.Split(new string[] { "\"price\"" }, StringSplitOptions.None)[1]; 701 gjcOldPrice = ConvertHelper.GetDouble(str43.Substring(str43.IndexOf("\"") + 1, str43.IndexOf("\",") - (str43.IndexOf("\"") + 1))); 702 string str44 = str42.Split(new string[] { "\"currentPrice\"" }, StringSplitOptions.None)[1]; 703 gjcNowPrice = ConvertHelper.GetDouble(str44.Substring(str44.IndexOf("\"") + 1, str44.IndexOf("\",") - (str44.IndexOf("\"") + 1))); 704 if (num6 < gjcNowPrice) 705 { 706 num6 = gjcNowPrice; 707 } 708 if (num7 > gjcNowPrice) 709 { 710 num7 = gjcNowPrice; 711 } 712 num8 += gjcNowPrice; 713 if (!(gjcOldPrice == 0.0)) 714 { 715 gjczhekou = Math.Round((double) (gjcNowPrice / gjcOldPrice), 2); 716 } 717 string str45 = str42.Split(new string[] { "\"ship\"" }, StringSplitOptions.None)[1]; 718 gjcPostage = ConvertHelper.GetDouble(str45.Substring(str45.IndexOf("\"") + 1, str45.IndexOf("\",") - (str45.IndexOf("\"") + 1))); 719 string str46 = str42.Split(new string[] { "\"tradeNum\"" }, StringSplitOptions.None)[1]; 720 gjcCjlThree = ConvertHelper.GetInteger(str46.Substring(str46.IndexOf("\"") + 1, str46.IndexOf("\",") - (str46.IndexOf("\"") + 1))); 721 if (gjcCjlThree > num3) 722 { 723 num3 = gjcCjlThree; 724 } 725 if (num4 > gjcCjlThree) 726 { 727 num4 = gjcCjlThree; 728 } 729 num5 += gjcCjlThree; 730 string str47 = str42.Split(new string[] { "\"commend\"" }, StringSplitOptions.None)[1]; 731 gjcYetEvaluate = ConvertHelper.GetInteger(str47.Substring(str47.IndexOf("\"") + 1, str47.IndexOf("\",") - (str47.IndexOf("\"") + 1))); 732 string str48 = str42.Split(new string[] { "\"nick\"" }, StringSplitOptions.None)[1]; 733 gjcwangw = str48.Substring(str48.IndexOf("\"") + 1, str48.IndexOf("\",") - (str48.IndexOf("\"") + 1)); 734 string str49 = str42.Split(new string[] { "\"sellerId\"" }, StringSplitOptions.None)[1]; 735 gjcwangID = str49.Substring(str49.IndexOf("\"") + 1, str49.IndexOf("\",") - (str49.IndexOf("\"") + 1)); 736 string str50 = str42.Split(new string[] { "\"itemId\"" }, StringSplitOptions.None)[1]; 737 gjcBbID = str50.Substring(str50.IndexOf("\"") + 1, str50.IndexOf("\",") - (str50.IndexOf("\"") + 1)); 738 string str52 = GetHtmlString1("http://count.tbcdn.cn/counter3?keys=ICVT_7_" + gjcBbID + ",ICCP_1_" + gjcBbID + "&callback=a"); 739 if ((str52 != "") && (str52.IndexOf("ICVT_7_") > -1)) 740 { 741 string str53 = str52.Split(new string[] { "ICVT_7_" }, StringSplitOptions.None)[1]; 742 if (str53.IndexOf(",") > -1) 743 { 744 if (gjcBC == "商城") 745 { 746 gjcBrowse = "----"; 747 } 748 else 749 { 750 gjcBrowse = str53.Substring(str53.IndexOf("\":") + 2, str53.IndexOf(",") - (str53.IndexOf("\":") + 2)); 751 } 752 } 753 else if (gjcBC == "商城") 754 { 755 gjcBrowse = "----"; 756 } 757 else 758 { 759 gjcBrowse = str53.Substring(str53.IndexOf("\":") + 2, str53.IndexOf("}") - (str53.IndexOf("\":") + 2)); 760 } 761 } 762 if ((str52 != "") && (str52.IndexOf("ICCP_1_") > -1)) 763 { 764 string str54 = str52.Split(new string[] { "ICCP_1_" }, StringSplitOptions.None)[1]; 765 if (str54.IndexOf(",") > -1) 766 { 767 gjcCollect = str54.Substring(str54.IndexOf("\":") + 2, str54.IndexOf(",") - (str54.IndexOf("\":") + 2)); 768 } 769 else 770 { 771 gjcCollect = str54.Substring(str54.IndexOf("\":") + 2, str54.IndexOf("}") - (str54.IndexOf("\":") + 2)); 772 } 773 } 774 string str56 = GetHtmlString("http://s.taobao.com/interfaces/shop_dsr.php?user_id=" + gjcwangID); 775 if ((str56 != "") && (str56.IndexOf("sgr") > -1)) 776 { 777 string str57 = str56.Split(new string[] { "\"sgr\"" }, StringSplitOptions.None)[1]; 778 gjcGoodEvaluate = ConvertHelper.GetDouble(str57.Substring(str57.IndexOf("\"") + 1, str57.IndexOf("%") - (str57.IndexOf("\"") + 1))); 779 if (num9 > gjcGoodEvaluate) 780 { 781 num9 = gjcGoodEvaluate; 782 } 783 num10 += gjcGoodEvaluate; 784 } 785 if ((str56 != "") && (str56.IndexOf("mas") > -1)) 786 { 787 string str58 = str56.Split(new string[] { "\"mas\"" }, StringSplitOptions.None)[1]; 788 gjcMiaosCode = ConvertHelper.GetDouble(str58.Substring(str58.IndexOf("\"") + 1, str58.IndexOf("\",") - (str58.IndexOf("\"") + 1))); 789 if (num11 > gjcMiaosCode) 790 { 791 num11 = gjcMiaosCode; 792 } 793 num12 += gjcMiaosCode; 794 } 795 if ((str56 != "") && (str56.IndexOf("sas") > -1)) 796 { 797 string str59 = str56.Split(new string[] { "\"sas\"" }, StringSplitOptions.None)[1]; 798 gjcFuwuCode = ConvertHelper.GetDouble(str59.Substring(str59.IndexOf("\"") + 1, str59.IndexOf("\",") - (str59.IndexOf("\"") + 1))); 799 if (num13 > gjcFuwuCode) 800 { 801 num13 = gjcFuwuCode; 802 } 803 num14 += gjcFuwuCode; 804 } 805 if ((str56 != "") && (str56.IndexOf("cas") > -1)) 806 { 807 string str60 = str56.Split(new string[] { "\"cas\"" }, StringSplitOptions.None)[1]; 808 gjcFahuoCode = ConvertHelper.GetDouble(str60.Substring(str60.IndexOf("\"") + 1, str60.IndexOf("\",") - (str60.IndexOf("\"") + 1))); 809 if (num15 > gjcFahuoCode) 810 { 811 num15 = gjcFahuoCode; 812 } 813 num16 += gjcFahuoCode; 814 } 815 string str62 = GetHtmlString("http://rate.taobao.com/ShopService4C.htm?userNumId=" + gjcwangID); 816 if ((str62 != "") && (str62.IndexOf("avgRefund") > -1)) 817 { 818 string str63 = str62.Substring(str62.IndexOf("avgRefund"), str62.IndexOf("punish") - str62.IndexOf("avgRefund")); 819 string str64 = str63.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 820 gjcPjRefund = ConvertHelper.GetDouble(str64.Substring(str64.IndexOf("\"") + 1, str64.IndexOf("\"}") - (str64.IndexOf("\"") + 1))); 821 string str65 = str63.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 822 num37 = ConvertHelper.GetDouble(str65.Substring(str65.IndexOf("\"") + 1, str65.IndexOf("\",") - (str65.IndexOf("\"") + 1))); 823 if (num17 < gjcPjRefund) 824 { 825 num17 = gjcPjRefund; 826 } 827 num18 = num37; 828 } 829 if ((str62 != "") && (str62.IndexOf("ratRefund") > -1)) 830 { 831 string str66 = str62.Substring(str62.IndexOf("ratRefund"), str62.IndexOf("complaints") - str62.IndexOf("ratRefund")); 832 string str67 = str66.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 833 gjcThreeRefund = ConvertHelper.GetDouble(str67.Substring(str67.IndexOf("\"") + 1, str67.IndexOf("\",") - (str67.IndexOf("\"") + 1))); 834 string str68 = str66.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 835 num39 = ConvertHelper.GetDouble(str68.Substring(str68.IndexOf("\"") + 1, str68.IndexOf("\",") - (str68.IndexOf("\"") + 1))); 836 if (num19 < gjcThreeRefund) 837 { 838 num19 = gjcThreeRefund; 839 } 840 num20 = num39; 841 } 842 if ((str62 != "") && (str62.IndexOf("complaints") > -1)) 843 { 844 string str69 = str62.Substring(str62.IndexOf("complaints")); 845 string str70 = str69.Split(new string[] { "\"localVal\"" }, StringSplitOptions.None)[1]; 846 gjcThreeComplain = ConvertHelper.GetDouble(str70.Substring(str70.IndexOf("\"") + 1, str70.IndexOf("\",") - (str70.IndexOf("\"") + 1))); 847 string str71 = str69.Split(new string[] { "\"indVal\"" }, StringSplitOptions.None)[1]; 848 num41 = ConvertHelper.GetDouble(str71.Substring(str71.IndexOf("\"") + 1, str71.IndexOf("\",") - (str71.IndexOf("\"") + 1))); 849 if (num21 < gjcThreeComplain) 850 { 851 num21 = gjcThreeComplain; 852 } 853 num22 = num41; 854 } 855 num23++; 856 string str72 = str42.Split(new string[] { "\"loc\"" }, StringSplitOptions.None)[1]; 857 gjcArea = str72.Substring(str72.IndexOf("\"") + 1, str72.IndexOf("\",") - (str72.IndexOf("\"") + 1)); 858 } 859 string gjcpm = j.ToString() + "位/" + i.ToString() + "页"; 860 this.SaveGjcTable(this.gjcxuhaoInt, gjcpm, gjcBbName, gjcBbID, gjcBbPic, gjcwangw, gjcwangID, gjcCjlThree, gjcdlistWeek, gjcdlistDate, gjcdlistSyTime, gjcBrowse, gjcCollect, gjcOldPrice, gjcNowPrice, gjczhekou, gjcPostage, gjcYetEvaluate, gjcGoodEvaluate, gjcMiaosCode, gjcFuwuCode, gjcFahuoCode, gjcPjRefund, gjcThreeRefund, gjcThreeComplain, gjcTsfw, gjcBC, gjcXinyu, gjcBbLm, gjcArea, gjcSearchTime); 861 if (base.InvokeRequired) 862 { 863 base.Invoke(new DeleGjcAddIng(this.GjcAddIng), new object[] { 864 this.gjcxuhaoInt, gjcpm, gjcBbName, gjcBbID, gjcBbPic, gjcwangw, gjcwangID, gjcCjlThree, gjcdlistWeek, gjcdlistDate, gjcdlistSyTime, gjcBrowse, gjcCollect, gjcOldPrice, gjcNowPrice, gjczhekou, 865 gjcPostage, gjcYetEvaluate, gjcGoodEvaluate, gjcMiaosCode, gjcFuwuCode, gjcFahuoCode, gjcPjRefund, gjcThreeRefund, gjcThreeComplain, gjcTsfw, gjcBC, gjcXinyu, gjcBbLm, gjcArea, gjcSearchTime 866 }); 867 } 868 } 869 catch (Exception) 870 { 871 } 872 } 873 } 874 } 875 if (base.InvokeRequired) 876 { 877 base.Invoke(new DeleGjcZSCom(this.GjcZSCom), new object[] { 878 num3, num4, num5, str8, num6, num7, num8, num9, num10, num11, num12, num13, num14, num15, num16, num17, 879 num18, num19, num20, num21, num22, num23 880 }); 881 } 882 if (base.InvokeRequired) 883 { 884 base.Invoke(new DeleGjcCom(this.GjcCom)); 885 } 886 } 887 catch 888 { 889 } 890 if (base.InvokeRequired) 891 { 892 base.Invoke(new DeleGjcCom(this.GjcCom)); 893 } 894 } 895 896