Created
March 29, 2012 09:17
-
-
Save bradens/2235314 to your computer and use it in GitHub Desktop.
Gmail Email grabber
This file contains hidden or 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
javascript:var script = document.createElement('script'); | |
script.src = 'http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js'; | |
script.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
function printEmails() { | |
$("#canvas_frame").contents().find(".yX.xY").each( | |
function(i, data) { | |
var contactsArr = $(data).find("[email]"); | |
var contactsStr = ""; | |
for (var j = 0;j < contactsArr.length-1;j++) | |
contactsStr += $(contactsArr[j]).attr('email') + ", "; | |
contactsStr += $(contactsArr[j]).attr('email'); | |
console.log("Email from : " + contactsStr); | |
} | |
); | |
} | |
function getNextPage() { | |
// get the # after /p | |
if (new RegExp("/p").test(window.location.href)) { | |
var pgNum = parseInt(window.location.href.split('/p')[1]); | |
pgNum++; | |
window.location.href = window.location.href.split('/p')[0] + "/p" +pgNum; | |
} | |
else | |
{ | |
window.location.href = window.location.href + "/p2"; | |
} | |
} | |
function GrabMails() { | |
// if the page doesn't have emails, then exit, else print the emails and click next. | |
if ($("#canvas_frame").contents().find('div[data-tooltip="Older"]')[0] !== undefined) | |
{ | |
printEmails(); | |
getNextPage(); | |
return setTimeout(GrabMails, 1000); | |
} | |
return; | |
} | |
setTimeout(GrabMails, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment