Following is some piece of code I used to download some example images from google earth view
function downloadURI(uri, name) {
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
}
apiUrl = "https://www.gstatic.com/prettyearth/";
var request = new XMLHttpRequest();
//image id from 1003 to 2448 include
for(var i = 1061; i <= 2448; ++i)
{
request.open(
'GET',
apiUrl + i + '.json',
false);
request.send();
if(request.status == 200)
{
console.log(i + 'was loaded');
var photo = JSON.parse(request.response);
if(photo.dataUri)
{
var uri = photo.dataUri.replace(/^data:image\/([^;]*)/, 'data:application/octet-stream');
downloadURI(uri, i + '.jpg');
//window.open(uri);
//location.href = photo.dataUri;
}
}
else
{
console.log(i + 'wasn\'t loaded');
}
}