开发者

How to parse random/unorganized rss feeds in Ruby/Rails?

I am facing problems while parsing RSS feeds from different sites. I need to fetch url, title and image from the feeds, but all of the sites have different structure for 开发者_运维技巧their feeds. Is is possible to have a generic script to fetch content from feeds of any structure?

How do browsers/feed readers/Google Reader handle this situation?


They shouldnt have a different structure unless they are different formats (ATOM, RSS, RSS 2.0, etc..). They should all be flagged as such within the document so you need to adjust your code to take this into account... I normally use a library that abstracts all this into a single API for access the various elements. I dont really do RoR but with php i use Zend_Feed. Im sure there is something like this in the Ruby world.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜