Skip to content

Instantly share code, notes, and snippets.

@jackmahoney
Created October 26, 2016 11:08
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 jackmahoney/06c1bdaddf30e78ce3d80b754e316200 to your computer and use it in GitHub Desktop.
Save jackmahoney/06c1bdaddf30e78ce3d80b754e316200 to your computer and use it in GitHub Desktop.
Scrape digitalagencynetwork.com
// 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