Skip to content

Instantly share code, notes, and snippets.

@jackmahoney
Created October 26, 2016 11:08

Revisions

  1. Jack Mahoney created this gist Oct 26, 2016.
    12 changes: 12 additions & 0 deletions script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    // 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'));