public static Dictionary <string, string> GetPaipaiItemPromoPrice(string onlineKey) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); string text = string.Empty; string url = "http://auction1.paipai.com/" + onlineKey; string responseContent = GetItemPromoPrice.GetResponseContent(url, Encoding.GetEncoding("gb2312")); if (!string.IsNullOrEmpty(responseContent)) { Regex regex = new Regex("(?is)<input[^>]*?id=\"stockStringNew\"\\s*?value=\"(?<value>.*?)\"", RegexOptions.IgnoreCase); Match match = regex.Match(responseContent); if (match != null && match.Success) { text = match.Groups["value"].Value; } } if (!string.IsNullOrEmpty(text)) { string[] array = text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (array != null && array.Length > 0) { string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; string[] array3 = text2.Split(new char[] { ',' }); if (array3 != null && array3.Length == 5) { string key = array3[4]; string value = array3[1]; dictionary[key] = value; } } } } return(dictionary); }
public static GetItemPromoPrice.TaobaoPromoPriceEntity GetTaobaoItemPromoPrice(string onlineKey) { GetItemPromoPrice.TaobaoPromoPriceEntity result = null; string url = "http://a.m.taobao.com/ajax/sku.do?item_id=" + onlineKey; string responseContent = GetItemPromoPrice.GetResponseContent(url, Encoding.GetEncoding("Utf-8")); try { if (!string.IsNullOrEmpty(responseContent)) { result = JsonConvert.DeserializeObject <GetItemPromoPrice.TaobaoPromoPriceEntity>(responseContent); } } catch (Exception ex) { Log.WriteLog(ex); } return(result); }