Skip to content

Instantly share code, notes, and snippets.

@techsin
Created August 13, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techsin/0ae2f05ce17a61c0745716cf82554795 to your computer and use it in GitHub Desktop.
Save techsin/0ae2f05ce17a61c0745716cf82554795 to your computer and use it in GitHub Desktop.
download audio recording in sms google voice
document.querySelectorAll('audio').forEach((au) => {
const url = au.currentSrc;
fetch(url).then(r => r.blob()).then(obj => downloadAudio(obj));
})
function downloadAudio(blob) {
const ele = document.createElement('a');
let counter = 0;
downloadAudio = function (blob) {
ele.download = "Audio" + ++counter;
ele.href = URL.createObjectURL(blob);
ele.click();
}
downloadAudio(blob);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment