Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Created January 8, 2011 00:38
Show Gist options
  • Select an option

  • Save ericmoritz/770375 to your computer and use it in GitHub Desktop.

Select an option

Save ericmoritz/770375 to your computer and use it in GitHub Desktop.
Calculates the average price for a craigslist search
(function() {
var total = 0;
var count = 0;
jQuery("p > a").each(function(i) {
var $this = jQuery(this);
var bits = $this.html().split(/ /);
var price = new Number(bits[0].substring(1));
if(!isNaN(price)) {
total += price;
count++;
}
});
alert("Average: " + (total/count));
})();
@bjinwright
Copy link

This script does this for a single page.

@brendonharrison
Copy link

Check out www.cldata.io for Craigslist pricing data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment