Created
October 26, 2016 11:08
-
-
Save jackmahoney/06c1bdaddf30e78ce3d80b754e316200 to your computer and use it in GitHub Desktop.
Scrape digitalagencynetwork.com
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
// execute in chrome snippets section on a page such as http://digitalagencynetwork.com/agencies/melbourne/ | |
// copy result into a csv file an voila | |
var $ = jQuery; | |
var results = []; | |
$('.entry .threecol-two.last').each(function(){ | |
var title = $(this).find('h3').text(); | |
var address = $(this).find('a').attr('href'); | |
var emailMatch = $(this).first('h6').text().match(/[\w\.]+@[\w\.]+/); | |
var email = emailMatch ? emailMatch[0] : 'unknown'; | |
results.push([title,address,email].join(',')); | |
}); | |
console.log(results.join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment