iovxw / rssbot

Lightweight Telegram RSS notification bot. 用于消息通知的轻量级 Telegram RSS 机器人

Home Page:http://t.me/RustRssBot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

有一些带锚点的 link

hellodword opened this issue · comments

有的时候 RSS 源不够标准,例如没有 guid

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title><![CDATA[WHO]]></title>
        <link>https://www.who.int/news-room/feature-stories</link>
        <item>
            <title><![CDATA[Article1]]></title>
            <pubDate>Wed, 23 Feb 2022 19:00:00 GMT</pubDate>
            <link>https://www.who.int/article1</link>
        </item>
    </channel>
</rss>

这个时候 rssbot 会去根据 title 和 link 生成 hash,但是有些 RSS 更加不标准到 link 带 锚点,于是这个 hash 就变了,就会再推送一次。

-            <link>https://www.who.int/article1</link>
+            <link>https://www.who.int/article1#test</link>

按照 RFC 定义,似乎是无论锚点怎么变,都应该指向同一个资源。

不知道你是如何看待这种场景(主要还是订阅的 RSS 那边不够标准,但我注意到程序参数中也有 --insecure 这样的妥协,所以...)

commented

按照 RFC 定义,似乎是无论锚点怎么变,都应该指向同一个资源。

我没有找到这部分定义,有没有引用?

RSS 的一个 item 应该以资源为单位作为自己的标识符吗?感觉一个 item 只表示一部分资源也是合法的

在 RSS 2.0 的 guid 定义里,锚点是算做标识符的一部分的 https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt

Atom 的规范里对于 id 的生成倒是有说

Preserve empty fragment identifiers and queries.

https://datatracker.ietf.org/doc/html/rfc4287#section-4.2.6

感谢纠正,那确实应该这样生成 guid,我只是看了 URI 的 RFC 关于 secondary resourceprimary resource 就想当然了...