Originally written in C, here’s a quick hack written in Python for reading an RSS 2.0 XML feed from standard input, outputting a list of enclosure URLs (eg. links to podcast mp3s).

import xml.parsers.expat, sys

def start_element(name, attrs):
  if name == 'enclosure':
    print attrs['url']

x = xml.parsers.expat.ParserCreate()
x.StartElementHandler = start_element
x.Parse(sys.stdin.read(), True)
 

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: