如何使用 ROME 将链接识别为 RSS Feeds 链接?

发布于 2024-07-14 04:19:53 字数 63 浏览 13 评论 0原文

我正在使用 ROME 库来解析提要。 我想知道如何将链接识别为 XML 链接或普通链接。 罗马对此有支持吗?

I am using ROME library for parsing feeds. I want to know how can I identify a link as an XML link or a normal link. Is there a support for this in ROME.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌︼了一个春 2024-07-21 04:19:53

听起来您好像在说您将从某个地方获得一堆链接(RSS 提要内容或其他内容)。 然后您需要仔细检查它们并确定它们是 RSS/Atom 提要还是常规 HTML 页面。

您可能可以尝试使用 Rome 获取它,然后查看它是否抛出异常。 更好的选择可能是在每个链接的末尾拉入文档并查看标题的内容。

请记住,如果有人链接到一个非常大的文件,检索每个链接可能会遇到问题。

在下载整个文件之前,您可能会考虑使用 HEAD 命令来找出在链接末尾将获得的文件类型。

It sounds like you are saying that you will be getting a bunch of links from somewhere (RSS feed content or something). Then you want to go through them and determine if they are RSS/Atom feeds or if they are regular HTML pages.

You could probably attempt to fetch it with Rome and then see if it throws an exception. A better option might be to pull in the document at the end of each link and see what the header says it is.

Keep in mind that retrieving each link is may run into a problem if someone links to a very large file.

You might look at using the HEAD command to find out what type of file you are going to get at the end of a link before downloading the entire thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文