I recently got a reasonable size list of blog URLs. What I wanted was to import all these into a feed reader (via OPML). There seemed to be a lack of conversion scripts for batch URL->find RSS link->feed reader import file (I may be wrong, please let me know if I am :), so I made one in PHP. I guess this is like an automatic-blogroller. I have just used this as a command line script, I'm not recommending you use this in 'the wild' as one might say, I have made little concession to security as I had a trusted list of URLs.
There are basically three steps to this
- Take an input file of newline seperated URLs, in my case blogs.
- Find (auto-discover) associated RSS feed of each blog URL
- Output an OPML file that you can use to import into a feed reader What it does:
- Takes a well formed list of newline separated URLs of blogs and turns it into an OPML
- If the URL source doesn't contain a <link> to an RSS feed in the head it doesn't add it to the OPML
Detects the <title> and adds that to the OPML text field, or uses the URL if <title> isn't present What it doesn't:
Check the RSS feed is validated XML
Any other checking really :)
Come with any sort of warranty/guarantee Some of the key functions are from Keith Devens work. Thanks. <!--more--> Without any further ado, here is the script:
Though this was really a one time hit for me it may well be useful to others. Please let me know if you can think of ways to improve it and I will update accordingly.