2012-05-01 103 views
3

我需要接收一些RSS源,并将所有添加到它们的项目归档。我以前从未使用过或创建过RSS,但是我知道xml,因此格式看起来非常直观。如何归档RSS提要?

我知道如何解析饲料:How can I get started making a C# RSS Reader?

我知道我不能依赖饲料服务器上提供了完整的历史:Is it possible to get RSS archive

我知道我必须有一些自定义逻辑周围重复:how to check uniqueness (non duplication) of a post in an rss feed

我的问题是,我如何确保我不会错过任何项目?我最初的计划是编写一个解析器,其中针对Feed中的每个项目: 1)检查它是否已经存在于存档数据库中 2)如果没有,请将其添加到数据库中 如果我安排此操作,一天,我可以相信我不会缺少任何物品吗?

回答

3

这取决于订阅源,一些网站发布文章的频率非常高,可能会将其RSS订阅源配置为仅显示最近的10篇文章。有些网站会做相反的事情。

理想情况下,您的应用程序应该从网站上'学习'这个频率,然后根据学习频率自行调整这些网站。 (例如:如果每次ping时都会看到新的独特文章,则需要更频繁地ping,另一方面,如果您在多次尝试中看到相同的文章集,可能会在下次回退)。

+1

这就是我想的,谢谢您的确认。 –

0

根据Feed和存储限制使用一系列决策。例如:

 
    Connect to the Web site, and download the XML source of the feed. The Feed Download Engine downloads feeds and enclosures via HTTP or Secure Hypertext Transfer Protocol (HTTPS) protocols only. 

    Transform the feed source into the Windows RSS Platform native format, which is based on RSS 2.0 with additional namespace extensions. (The native format is essentially a superset of all supported formats.) To do this, the Windows RSS Platform requires Microsoft XML (MSXML) 3.0 SP5 or later. 

    Merge new feed items with existing feed items in the feed store. 
    Purge older items from the feed store when the predetermined maximum number of items have been received. 

    Optionally, schedule downloads of enclosures with Background Intelligent Transfer Service (BITS). 

使用HTTP发挥到极致,以尽量减少带宽浪费:

要限制其对服务器的影响,饲料下载引擎实现HTTP条件GET与HTTP增量编码(RFC3229)合并万维网链接。此实现允许服务器传输最低限度的更改说明,而不是传输客户端上缓存的全新资源实例。该引擎还支持使用Microsoft Win32 Internet(WinInet)的HTTP gzip支持进行压缩。

成功的同步意味着Feed已成功下载,验证,转换为本机格式并合并到商店中。响应于HTTP条件GET(If-Modified-Since,If-None-Match,ETag等)的HTTP 304 Not Modified的服务器响应也构成成功。

,并定义标准去除:

 
The following properties directly affect the number of items that remain after a synchronization operation. 

    PubDate—used to determine the "age" of items. If PubDate is not set, LastDownloadTime is used. If the feed is a list, the order of items is predetermined and PubDate (if present) is ignored. 

    MaxItemCount—a per-feed setting that limits the number of archived items. The feed's ItemCount will never exceed the maximum, even if there are more items that could be downloaded from the feed. 

    ItemCountLimit—the upper limit of items for any one feed, normally defined as 2500. The value of MaxItemCount may not exceed this limit. Set MaxItemCount to ItemCountLimit to retain the highest possible number of items. 

参考

2

如果你打开依托这个服务...我建立了自己的RSS档案服务(https://app.pub.center)。您可以通过我们的API访问RSS提要的数据。的大西洋 https://pub.center/feed/02702624d8a4c825dde21af94e9169773454e0c3/articles?limit=10&page=1

页2大西洋 https://pub.center/feed/02702624d8a4c825dde21af94e9169773454e0c3/articles?limit=10&page=2

的REST API的

第1页是免费的。我们有推送通知的定价计划(电子邮件,短信,您的自定义API端点)