Created
September 2, 2011 00:00
-
-
Save oquno/1187623 to your computer and use it in GitHub Desktop.
i-Radio downloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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