Created
August 13, 2020 17:53
-
-
Save techsin/0ae2f05ce17a61c0745716cf82554795 to your computer and use it in GitHub Desktop.
download audio recording in sms google voice
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
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