Download Podcast from RSS

Here’s a small script I wrote. It checks the RSS feed for a podcast (for example, Democracy Now) and downloads the most recent episode to a file on your hard disk.

You need at least Build 861 of mAirList 3.1.4, and curl.exe from here: http://curl.haxx.se/download.html (scroll to the bottom of the page for the non-SSL Win32 binary). Adjust all paths as needed.

var
  doc: IXMLDocument;
  n: IXMLNode;

begin
  doc := Factory.CreateXMLDocumentFromString(HTTPGet('http://www.democracynow.org/podcast.xml'));
  n := doc.GetDocumentElement.SelectSingleNode('/rss/channel/item/enclosure');
  ShellExecute('c:\apps\curl.exe', '-L -o c:\tmp\democracynow.mp3 "' + IXMLElement(n).GetAttribute('url') + '"');
end.
1 Like