Google provides a way of browsing through and, optionally, deleting all or selected “OK Google” voice requests that you’ve made: it’s called My Activity > Voice & Audio, and while it’s useful, there’s no mechanism provided for downloading the voice snippets in bulk.
Which is just the kind of thing I’d like to do, for archival purposes, before deleting anything.
From the looks of it, nobody’s come up with an easy way to automate this, so I’ve developed a not-very-easy way of doing so.
Here’s what you need to do (using Firefox; if you’re using another browser you’ll have to use a different tool for the final downloading step):
First, login to the My Activity > Voice & Audio page for the account you want to archive requests for.
Second–and this is one of the not-very-easy parts–keep scrolling and scrolling (and scrolling) down until you see the very first of your “OK Google” requests. The page lazy-loads new requests as you scroll, so this can take a while. It took me about 10 minutes to get down to November 2014, where my first request to Google was “what is a high fever in Celsius”:
Next, save the web page as an HTML file called voice-history.html. It will be a large file, but that’s okay.
Buried inside this HTML file are the Google URLs for the individual voice files, on lines like this:
<!----><audio-player ng-if="::!detailsItem" audio-url="/history/audio/play/1490302747998829"><button class="history-audio-button md-button md-ink-ripple" type="button" ng-transclude="" ng-click="controller.togglePlay()" aria-label="Play">
Extract all of these from the command line and into a text file:
grep "audio-url" voice-history.html > audiourls.txt
Then use your favourite text editor to do some searching-and-replacing so that you end up with a plain list of URLs that looks like this:
https://myactivity.google.com/history/audio/play/1490367941523848 https://myactivity.google.com/history/audio/play/1490359331224911 https://myactivity.google.com/history/audio/play/1490302747998829 https://myactivity.google.com/history/audio/play/1490278534174703
Save this as a text file for later reference.
Next, open Firefox, and install the DownThemAll! add-on.
Making sure you’re logged in to the same Google account as you grabbed your voice history for, select Tools > DownThemAll! Tools > Manager. From within the new Manager window that opens, right-click and select Advanced > Import from File from the context menu. Select the list of URLs that you saved above.
Once the list of URLs has loaded into the Manager, open the Filters section, and check “All files” to select all of the files for download. To ensure that the files end up with a .mp3 extension, edit the Mask field and change the contents to *name*.mp3. The result will look something like this:
Finally, click “Start” and then wait as Firefox downloads each voice snippets as an MP3 file; the add-on is very quick, and in my case the 1,697 snippets downloaded in a couple of minutes.