private static void ParseOutput(HtmlNode node, OutputInfo info) { for (var i = 0; i < node.ChildNodes.Count; i++) { var child = node.ChildNodes[i]; if (child.Name == "img") { var src = child.Attributes["src"].Value; if (src.IndexOf("[imageHost]") > -1) { var imageHost = DomainUtil.GetDomain("image"); //重写地址 child.Attributes["src"].Value = src.Replace("[imageHost]", imageHost); } } ParseOutput(child, info); } }
private static void ParseInput(HtmlNode node, InputContent info) { for (var i = 0; i < node.ChildNodes.Count; i++) { var child = node.ChildNodes[i]; if (child.Name == "img") { var src = child.Attributes["src"].Value; var imageHost = DomainUtil.GetDomain("image"); if (src.IndexOf(imageHost) > -1) { //提取key info.ImageKeys.Push(ImageUtil.ParseKey(src)); //重写地址 child.Attributes["src"].Value = src.Replace(imageHost, "[imageHost]"); } //(?<=http://)[\w\.]+[^/] } ParseInput(child, info); } }