« Why 1.0 is best.. | Main | Identifying unique visitors to a website »
April 13, 2005
Merging multiple RSS feeds
Suzanne thought it would be a good idea if we could merge multiple news feeds from BIOME, HS&P and HEALTH-01 for our joint portal page.
Whilst unconvinced of the requirement for such a thing I have come up with the following:
- http://www.ltsn-01.ac.uk/static/merge_feeds.php
To get a text/xml
view of it in your browser use:
- http://www.ltsn-01.ac.uk/static/merge_feeds.php?debug=1
The script is as follows:
- http://www.ltsn-01.ac.uk/static/merge_feeds.txt
Merging multiple RSS feeds into one involves de-duping based on link URLs in items and interleaving items so that they appear next to items of the same age in the final feed.
The script pulls our news feed and the feed from a blog we're hosting and represents them. In theory it can handle as many feeds as you want.
But why? I hear you ask.. Errm.. still not sure? Suzanne?
As a side effect of all this work, I was determined to get the feed to validate on http://feedvalidator.org.
It doesn't like my image references so those are gone from the feed, then it was a matter of getting the right content-type (application/rss+xml
), stripping annoying Windows meta characters from the feed, making sure there are no duplicate URLs, and I've UTF-8 encoded the final output for good measure.
- http://www.ltsn-01.ac.uk/static/strip_ms_chars.txt
Basically all the problems we've had with the LOM XML stuff.
I've done this with the rest of our feeds too and they now validate.
Posted by pj at April 13, 2005 04:58 PM