获取淘宝商品描述和价格

1)价格

(?<=<strong\\s+[^>]*\"J_StrPrice\"\\s+>)(?<1>[^<]*)(?=</strong>) 

2)描述 

分为2步,先获取描述地址,后获取地址内容。 

(?<=')(?<1>http://dsc.taobaocdn.com.*)(?=')

取得地址后url 后,请求 http://dsc.taobaocdn.com/url

(?<=desc=')(?<1>.*)(?=';) 

 代码

 1             Regex reg = new Regex(regExpGoodsDescString);
 2             string tbdescUrl = GetMatchString(reg);
 3             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(tbdescUrl);
 4             
 5             HttpWebResponse req = (HttpWebResponse)request.GetResponse();
 6             Stream stream = req.GetResponseStream();
 7             StreamReader sr = new StreamReader(stream, Encoding.Default);
 8             string desc = sr.ReadToEnd();
 9 
10             reg = new Regex("(?<=desc=')(?<1>.*)(?=';)", RegexOptions.Singleline | RegexOptions.Compiled);
11             return GetMatchString(reg, desc);
原文地址:https://www.cnblogs.com/lfwolf/p/1907339.html