如何过滤RSS Feed?
答案 0 :(得分:0)
我正在用C#构建一个程序。像这样:
string originalFeedUrl = args[ 0 ];
string regex = args[ 1 ];
XmlDocument doc = new XmlDocument();
doc.Load( originalFeedUrl );
XmlNodeList descriptions = doc.SelectNodes( @"//item/description" );
foreach( XmlNode description in descriptions ) {
if( !Regex.IsMatch( description.InnerText, regex ) )
description.ParentNode.ParentNode.RemoveChild(description.ParentNode );
}
Console.WriteLine(doc.OuterXml);