存储 rss 项目是否已被阅读的最佳方式是什么
作为一名非专业程序员,我正在尝试自学一点 HTML 和 javascript。我的学习项目是一个桌面小工具,可以从 RSS 提要中检索 RSS 项目。
我想要一个切换选项,以便小工具的用户可以决定显示所有项目或仅显示新项目(未读项目)。它仅显示我有疑问的新项目。
我意识到我必须在本地存储某种数据,我可以用它来与最近的获取结果进行比较,以查看某些内容是否是新的。
此比较中使用的典型数据是什么?它通常存储在 xml 文件还是其他类型的文件中?
谢谢。
As a non-professional programmer, I'm trying to self teach myself a little HTML and javascript. My learning project is a desktop gadget that will retrieve rss items from an rss feed.
I would like an option to toggle so the user of the gadget can decide to display all items or only new items (unread items). It's displaying only the new items that I have a question about.
I realize I have to locally store some kind of data that I can use to compare to the most recent fetch results to see if something is new or not.
What is the typical data that is used in this comparison and is it typically stored in a xml file, or some other kind of file?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在RSS 规范中,
guid
元素应包含每个项目的唯一标识符,但并非所有 rss feed 都遵循这一点,因此您可以将其与 < a href="http://www.w3schools.com/rss/rss_tag_pubdate_item.asp" rel="nofollow noreferrer">日期
检查。建议的简单存储:
此文件包含小工具中每个 rss feed 最后一项的信息,以空格分隔(您也可以像在
.csv
文件中那样用逗号分隔它们) ),第一个字段是 RSS URL,第二个字段是用于检查最后一项的方法,通过guid
或通过pubDate
,最后一个字段是要检查的值。在示例文件中,出于存储目的,我放置了时间戳而不是到达的 pubDate 。In RSS Specifications,
guid
element should contain a unique identifier for each item, but not all rss feeds respect that, so you may combine that with adate
check.Suggested Simple Storage:
This file contains info on the last item of each rss feed in the gadget, space separated (you can comma-separate them as in
.csv
files as well), first field is the RSS URL, second is the method used to check last item, either viaguid
or viapubDate
, last is the value to check. In the sample file I put the timestamp instead of thepubDate
that arrives, for storage purposes.