我有任务要做。
我需要下载一个网页并查看该页面是否包含任何 RSS 源。
我知道如何使用 C# 中的 Http API 将网页下载到字符串,但如何确定 http 页面字符串是否包含任何 RSS 提要?
谢谢
jack
最佳答案
我希望您必须将页面加载到 dom(XmlDocument
、XDocument
或 HtmlDocument
)中,并检查是否有任何节点,例如:
<link rel="alternate" type="application/atom+xml" ...
这应该是(在 xpath 中)类似 "/html/head/link[@rel='alternate' and @type='application/atom+xml']"
- 然后看看@title
和 @href
。
关于c# - C# 判断网页是否有RSS的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1762874/