Skip to content

Instantly share code, notes, and snippets.

@madsobel
Last active March 28, 2017 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madsobel/14c6f515aac047831c9fb2dd5e25d303 to your computer and use it in GitHub Desktop.
Save madsobel/14c6f515aac047831c9fb2dd5e25d303 to your computer and use it in GitHub Desktop.
function extractData() {
var emailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi
var data = [];
$('.feed-s-comment-item__inline-show-more-text').each(function() {
var name = $(this).find('.feed-s-comment-item__name').text()
var comment = $(this).find('.feed-s-comment-item__main-content span span').text().toLowerCase()
var email = comment.match(emailRegex)
if (email) {
data.push({
name: name,
email: email[0]
})
}
})
console.log('Here\'s the data:')
console.log(JSON.stringify(data))
console.log(data.length)
}
if ($('#show_prev').is(':visible')) {
var interval = setInterval(function() {
if (!$('#show_prev').is(':visible')) {
console.log('Im done..');
clearInterval(interval)
extractData()
} else {
console.log('Let\'s click! ');
$('#show_prev').click()
}
}, 2000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment