/// <summary> /// 主要处理内容里广告性质的文字及样式 /// </summary> /// <param name="contents"></param> /// <returns></returns> private string DealContent(string contents) { var str = contents; str = StrHelper.FormatScript(str); str = Global.RemoveSymbol(str); try { var p1 = "<span class=\"ifengLogo\"><a href=\"http://www.ifeng.com/\" target=\"_blank\"><img src=\"http://p2.ifengimg.com/a/2016/0810/204c433878d5cf9size1_w16_h16.png\"></a></span></p>"; str = Regex.Replace(str, p1, ""); str = str.Replace(p1, ""); var p2 = "<img src=\"http://p2.ifengimg.com/a/2016/0810/204c433878d5cf9size1_w16_h16.png\">"; str = Regex.Replace(str, p2, ""); str = str.Replace(p2, ""); } catch (Exception ex) { } str = StrHelper.RemoveHref(str); str = StrHelper.RemoveImgStyle(str); return(str.Trim()); }
/// <summary> /// 主要处理内容里广告性质的文字及样式 /// </summary> /// <param name="contents"></param> /// <returns></returns> private string DealContent(string contents) { var str = contents; str = StrHelper.FormatScript(str); str = Global.RemoveSymbol(str); try { var i01 = str.LastIndexOf("【腾讯佛学】"); if (i01 > 0) { str = str.Substring(0, i01); } if (str.Contains("上微信搜")) { i01 = str.LastIndexOf("<span"); if (i01 > 0) { str = str.Substring(0, i01); } } if (str.Contains("上微信搜")) { i01 = str.LastIndexOf("<span"); if (i01 > 0) { str = str.Substring(0, i01); } } if (str.Contains("上微信搜")) { i01 = str.LastIndexOf("<span"); if (i01 > 0) { str = str.Substring(0, i01); } } } catch (Exception ex) { } str = StrHelper.RemoveImgStyle(str); str = StrHelper.RemoveHref(str); return(str); }