开发者

What's the best way to store whether or not an rss item has been read

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 ne开发者_开发知识库w 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.


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 a date check.

Suggested Simple Storage:

http://example.com/link/to/file.rss guid abcd-ef-12345678
http://example.ord/some/other.rss date 1283647074

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 via guid or via pubDate, last is the value to check. In the sample file I put the timestamp instead of the pubDate that arrives, for storage purposes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜