So I use Google Voice for my voicemail, which gives often ridiculous computer transcriptions of the voicemail. I also use Vonage, which gives quite accurate human transcriptions, and includes an mp3 of the voicemail in the email. This is a much better situation, but Google Voice doesn’t let me turn of its voicemail so that only my Vonage voicemail service takes messages. Arg. So in my annoyance, I decided to try to write a script to download the mp3s from Google Voice. Turns out it was quite easy, especially because I was using python. Here’s my script, to use it, right click on the Play message link in the email, and copy it, then use that URL as the argument to this script (you’ll probaby want to change the dldir to something that works for your computer):
#!/usr/bin/python
import sys, re, time
from urllib2 import Request, urlopen, URLError, HTTPError
dldir = '/Users/hans/Desktop/'
url = sys.argv[1]
f = urlopen(url)
pagecontents = f.read()
f.close()
regex = re.compile("'messagePath': '(.*)'", re.MULTILINE)
for match in regex.finditer(pagecontents):
mp3url = match.group(1)
regex = re.compile('gc-message-name">(.*)(.*)</span', re.MULTILINE)
for match in regex.finditer(pagecontents):
msgtime = match.group(1)
msgdate = time.strftime('%Y-%m-%d %H.%M', time.strptime(msgtime, "%m/%d/%y %I:%M %p"))
filename = 'voicemail from ' + name + ' on ' + msgdate + '.mp3'
print "filename: " + filename
mp3 = urlopen(mp3url)
mp3contents = mp3.read()
mp3.close()
writefile = open(dldir + filename, 'w')
writefile.write(mp3contents)
writefile.close()