Skip to content

Instantly share code, notes, and snippets.

@oquno
Created September 2, 2011 00:00
Show Gist options
  • Save oquno/1187623 to your computer and use it in GitHub Desktop.
Save oquno/1187623 to your computer and use it in GitHub Desktop.
i-Radio downloader
# usage: $ python iradio_downloader.py "http://www2.i-radio.fm/i-radio/program/clammbon/223/wmp.asx" "gomamiso_223.mp3"
import sys, os
from urllib2 import urlopen
from BeautifulSoup import BeautifulStoneSoup
def save_mms(url, filename):
command = 'mimms "%(url)s" "%(filename)s"' % { 'url': url, 'filename': filename }
print command
os.system(command)
return
def get_mms_url(url):
url = BeautifulStoneSoup(urlopen(url).read()).find('entryref')['href']
return BeautifulStoneSoup(urlopen(url).read()).find('ref')['href']
filename = 'iradio.mp3'
if len(sys.argv) > 2:
filename = sys.argv[2]
save_mms(get_mms_url(sys.argv[1]), filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment