亚马逊 过滤价格 备用
来源:互联网 发布:淘宝查询历史价格 编辑:程序博客网 时间:2024/04/27 22:28
private void CheckHtmlContent(string pageContent, Product product) { #region 秒杀 string pattern = "<[a-zA-Z0-9][^>]+?id=\"priceblock_dealprice\"[^>]+?>(.|\\s)*?</td>"; var matchPrice = Regex.Match(pageContent, pattern); var salepattern = "<[a-zA-Z0-9][^>]+?id=\"priceblock_saleprice\"[^>]+?>.*?</span>"; var salematchPrice = Regex.Match(pageContent, salepattern); if (matchPrice.Success) { pattern = "<span[^>]*>((?!</span>).*)</span>"; ; var dealPrice = Regex.Match(matchPrice.Value, pattern); if (dealPrice.Success) { var truePrice = float.Parse(dealPrice.Groups[1].Value.Substring(product.lang.Length).Replace(",", "")); if (truePrice < product.expectPrice) { if (!product.isAlreadyNotificationExpectPrice) { product.isAlreadyNotificationExpectPrice = product.isNotificationExpectPrice = true; } } if (truePrice < product.minPrice) { product.isNotification = true; product.minPrice = truePrice; } } else throw new Exception("没有找到秒杀价格_" + product.productID + "\n" + product.url + pageContent); } #endregion #region 特价 //<span id="priceblock_saleprice" class="a-size-medium a-color-price">¥4,599.00</span> else if (salematchPrice.Success) { salepattern = "<span[^>]*>((?!</span>).*)</span>"; ; var dealPrice = Regex.Match(salematchPrice.Value, salepattern); if (dealPrice.Success) { var truePrice = float.Parse(dealPrice.Groups[1].Value.Substring(product.lang.Length).Replace(",", "")); if (truePrice < product.expectPrice) { if (!product.isAlreadyNotificationExpectPrice) { product.isAlreadyNotificationExpectPrice = product.isNotificationExpectPrice = true; } } if (truePrice < product.minPrice) { product.isNotification = true; product.minPrice = truePrice; } } else throw new Exception("没有找到特价价格_" + product.productID + "\n" + product.url + pageContent); } #endregion #region normal else { pattern = "<[a-zA-Z0-9][^>]+?id=\"priceblock_ourprice\"[^>]+?>.*?</span>"; matchPrice = Regex.Match(pageContent, pattern); if (!matchPrice.Success) throw new Exception("没有找到平时价格_" + product.productID + "\n" + product.url + pageContent); else { //pattern = "(¥)(\\d+)(,\\d+)*"; pattern = "<span[^>]*>((?!</span>).*)</span>"; var dealPrice = Regex.Match(matchPrice.Value, pattern); if (dealPrice.Success) { var truePrice = float.Parse(dealPrice.Groups[1].Value.Substring(product.lang.Length).Replace(",", "")); if (truePrice < product.expectPrice) { if (!product.isAlreadyNotificationExpectPrice) { product.isAlreadyNotificationExpectPrice = product.isNotificationExpectPrice = true; } } if (truePrice < product.minPrice) { product.isNotification = true; product.minPrice = truePrice; } } else throw new Exception("没有找到平时价格_" + product.productID + "\n" + product.url + pageContent); } } #endregion SendNotification(product); }
0 0
- 亚马逊 过滤价格 备用
- AmazonPriceTracker.net:跟踪亚马逊价格
- 微软下调Azure云服务价格 与亚马逊竞争
- 亚马逊AWS vs.谷歌GCE,飙的是价格?
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 备用
- 社会工程学攻击经典方法总结
- 通过简单C编程实现注册表修改
- 病毒预报:Trojan_Generic.F
- Apache HTTP Server存在…
- 浅谈Linux下的文件系统
- 亚马逊 过滤价格 备用
- 初讲队列
- 小企业也需要大安全:务必关注四大…
- 工控系统安全 不容忽视的安全领域
- 链表的C语言实现(一)
- 链表的C语言实现(二)
- 链表的c语言实现(三)
- 链表的C语言实现(四)
- 链表的C语言实现(五)