Skip to content

Instantly share code, notes, and snippets.

@alberto98fx
Created November 30, 2017 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alberto98fx/ff86320f51307cb99c84bc1cd9d6ce2f to your computer and use it in GitHub Desktop.
Save alberto98fx/ff86320f51307cb99c84bc1cd9d6ce2f to your computer and use it in GitHub Desktop.
WhatsApp tools
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