Created
February 24, 2017 10:12
-
-
Save askeing/f9a29e55e32f90e667bc9de4f6ad2a94 to your computer and use it in GitHub Desktop.
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
// inject: https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js | |
var downloadBtnDiv = document.getElementsByClassName("profileSharingProfileDownloadButton")[0]; | |
var downloadBtn = downloadBtnDiv.childNodes[0].childNodes[0]; | |
downloadBtn.click(); | |
var downloadLinks = document.getElementsByClassName("profileSharingDownloadLink"); | |
var firstDownloadLinks = downloadLinks[0]; | |
var downloadObjURL = firstDownloadLinks.href; | |
var localFile = "askeingprofiledata.json"; | |
var myBlob; | |
var myFile; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', downloadObjURL, true); | |
xhr.responseType = 'blob'; | |
xhr.onload = function(e) { | |
if (this.status == 200) { | |
myBlob = this.response; | |
console.log(myBlob); | |
// myFile = new File([myBlob], localFile); | |
myFile = saveAs(myBlob, localFile); | |
} | |
}; | |
xhr.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment