Created
November 30, 2017 21:06
-
-
Save alberto98fx/ff86320f51307cb99c84bc1cd9d6ce2f to your computer and use it in GitHub Desktop.
WhatsApp tools
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
function saveFile(url) { //blob:url do not forget BLOB before the url | |
var filename = url.substring(url.lastIndexOf("/") + 1).split("?")[0]; | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType = 'blob'; | |
xhr.onload = function() { | |
var a = document.createElement('a'); | |
a.href = window.URL.createObjectURL(xhr.response); | |
a.download = filename; // Set the file name. | |
a.style.display = 'none'; | |
document.body.appendChild(a); | |
a.click(); | |
delete a; | |
}; | |
xhr.open('GET', url); | |
xhr.send(); | |
} | |
//get blob images | |
var yaz = document.getElementsByClassName("image-thumb-body"); | |
for(var i=0; i<yaz.length; i++){ console.log(yaz[i].src); } | |
//get private chats text messages | |
var yaz = document.getElementsByClassName("bubble bubble-text copyable-text"); | |
for(var i=0; i<yaz.length; i++){ console.log(yaz[i].innerText); } | |
//get groups chats text messages | |
var yz = document.getElementsByClassName("bubble bubble-text has-author copyable-text"); | |
for(var i=0; i<yz.length; i++){ console.log(yz[i].innerText); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment