Unify(converge) Multiple RSS Feeds into One Site Feed [한글 페이지]
Who wants to use "BMUnifyFeeds"?
Before Using the Script
How to Unify(converge) Multiple Feeds into a Single Site Feed
Troubleshooting
Introduction
BMUnifyFeeds, written in Python CGI, is designed to unify(converge) multiple RSS feeds in a web site into a single site feed that can conveniently accomodates all your feeds generated in different formats. What BMUnifyFeeds script does is simply parsing all the feeds you want to unify(converge) into one feed, extracting all the item elements from XML's, sorting the extracted entries by publish time, and finally arranging them in a single site feed. Often, a web site may or may not provide multiple feeds on purpose. Sometimes, it's convinient but sometimes messy. Thus, it might be a good idea to provide a single unified(converged) site feed to visitors.
There are many different feed formats, generated by tens of blogs such as TypePad, WordPress, Blogger, and so forth. In addition, a feeds may have a RSS or ATOM type. Thus, it is not to say that a "smart" unification(convergence) mechanism must be ideal. However, the script was originally intended for my personal use- working on my site - and study. That means the unification(convergence) mechanism is not very sophisticated, but trivially a brute-force method. Note that it's not tested with hundreds entries in hudreds RSS feeds. Be aware that the more feeds, the more server overhead! My script is to demonstrate an idea and just enough to work in smal-scale.
Anyone can use, modify, spread it out, or do anything with my script but PLEASE LET ME KNOW if you find any bug, make a better change on your own, or have a comment, suggestion, or whatsoever.
| So, why not try it! | |
Who wants to use "BMUnifyFeeds"?
2. Someone has a BBS, and each board generates a seperated RSS feed,
3. Someone has a blog and also uses a feed generator for traditional static HTML web pages,
but wish to provide a unified(converged) feed to his/her visitors.
4. Finally, someone thinks simple is good!
Before Using the Script
| NOTE |
- Your web hosting server MUST support Python, which is included in most Linux distros as a defaul package these days.
- My script support ONLY UTF-8 encoding.
- Pay attention to Python's tabbed syntax. Python language uses tab spaces to desitinguish its syntax. Sometimes, the tabbed syntax is unintentionally messed up when people work cross platforms (Windows/POSIX) but uses a text editor that doesn't recognizes and automatically converts between DOS/UNIX input format. Edit the code with an advanced text editor such as Notepad++ and Eclipse (just what I usually use because they are free and excellent).
- View source code in HTML
- Download source code ONLY - it has .py extension rather than .cgi, and won't work without the configuration file.
How to Unify Multiple Feeds into a Single Site Feed
Step 1.
Download
BMUnifyFeeds.zip (CGI script and configuration file)
Step 2.
First, you need to know the path to Python on your hosting server. Open a telnet session and use the following command to obtain the path. If you get nothing, your server may not have Python installed.
/home/bin/python
Step 3.
Open the file BMUnifyFeeds.cgi and replace the very first line with the path to Python obtained in Step 2.
# -*- coding: utf-8 -*-
# DO NOT REMOVE THE ENCODING DECLARATION ABOVE
Step 4.
Open the file feed.info and replace each line with your feed info and add additional info as needed (see CAUTION 1).
title=Blue Mojo's Site Feed
homepage_url=http://www.ibluemojo.com
desc=Blue Mojo's blog, board, podcast, photolog
# URLs of your feeds to unify(converge). Add additional info as needed. (e.g. feed_4, feed_5...)
feed_1=http://www.ibluemojo.com/rss.xml
feed_2=http://www.ibluemojo.com/page_feed.xml
feed_3=http://www.ibluemojo.com/blog/rss
# Add all the URLs of XML namespace definations that are certainly used in your feeds.
# Do not add extra XML namespaces that are not actually used in your feeds.
# Blogger
xmlns:atom=http://www.w3.org/2005/Atom
xmlns:openSearch=http://a9.com/-/spec/opensearchrss/1.0/
# WordPress
xmlns:content=http://purl.org/RSS/1.0/modules/content/
xmlns:wfw=http://wellformedweb.org/CommentAPI/
xmlns:dc=http://purl.org/dc/elements/1.1/
Don't worry about filling the part for the XML namespace above in the feed.info file. You can easily find the information about the XML namespaces used in your RSS feeds by opening the RSS feed file in your favorite browser or text editor (see CAUTION 2). They appears on the top of the XML page as shown below (see CAUTION 3, 4).

| CAUTION |
- Follow the existing format when modifing the feed.info file. Do NOT modify the keys, such as "title", "feed_1", and so on. And, NO SPACE between the keys and values.
e.g. key=[here is what you want to change] - Most recent browsers render a XML page instead of showing its tree structure. In that case, open it with a text editor to investigate the XML namespace information.
- You must specify ALL the XML namespaces that are certainly USED in your feeds that you're about to unify(converge). Adding extra XML namespaces not actually used in your feed may result XML parsing error.
- If you copy and paste XML namespace info, be careful NOT to include quotation marks wrapping the URL in the feed.info file.
Step 5.
Upload the modified files to a desired directory on your server. Note that two files must be in the same directory. Use a FTP client or the command below to set the permission of the CGI script to 755 (-rwxr-xr-x).
Step 6.
After all done, test your unified(converged) site feed by opening the URL of http://yourdomain/dir/BMUnifyFeeds.cgi in your browser. If a XML page is successfully generated, you're done and your feed URL is ready to spread out on the web!
Troubleshooting
HTTP 500 Internal Sever Error.
| Check whether your sever have Python installed (see NOTE 1, Step 2.), you forget setting the permission of the CGI script to 755 (see Step 5.), or your CGI script was messed up with tab spaces (see Note 3). |
Browser cannot display this feed. XML parsing error: reference to undeclared namespace prefix: '...' line: ...
| Check whether you forget adding all the XML namespace definitions or your feed.info file has typos or incorrect information for XML namespaces (see CAUTION 1, 3, 4). |
Browser cannot display this feed. XML parsing error: no element found. line: 1, colum: 1
| Check whether you add extra XML namespace definitions that are not actually used in your feed, or your feed.info file has typos or incorrect information for XML namespaces (see CAUTION 1, 3, 4). |
Browser display a normal text rather than a well-structured XML page.
| Clear browser's history and temporary files completely, close the browser, and then reopen the CGI script in the browser. If the problem still remains unsolved, your feeds may not be UTF-8 encoded (see NOTE 2). |
| TIP |
- After making any change to fix a problem, completely close your browser and reopen it to test the change. Sometimes, you may also need to clear history and temporary files of your browser.
- To investigate errors in a XML feed, use a friendly tool Feed Validator!

