Advertisement
Guest User

Untitled

a guest
Jan 4th, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function(){
  2.     let saveBlob = (function () {
  3.         let a = document.createElement("a");
  4.         document.body.appendChild(a);
  5.         a.style = "display: none";
  6.         return function (blob, fileName) {
  7.             let url = window.URL.createObjectURL(blob);
  8.             a.href = url;
  9.             a.download = fileName;
  10.             a.click();
  11.             window.URL.revokeObjectURL(url);
  12.         };
  13.     }());
  14.     let a = document.querySelectorAll('a');
  15.     let emails = [];
  16.     for(let i = 0; i < a.length; i++) {
  17.         let e = a[i];
  18.         if (e.href && e.href.startsWith('mailto:')) {
  19.             let email = e.href.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi);
  20.             if (email.length > 0 && emails.indexOf(email[0]) == -1) {
  21.                 emails.push(email[0]);
  22.             }
  23.         }
  24.     }
  25.     if (emails.length > 0) {
  26.         let blob = new Blob([emails.join("\r\n")], { type: "text/plain;charset=utf-8"});
  27.         saveBlob(blob, 'emails.txt');
  28.     } else {
  29.         alert('no mailto addresses');
  30.     }
  31. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement