Permalink
Browse files

Entity decoding for montreeaalll.

  • Loading branch information...
1 parent f869571 commit a5ac5b38c9e9c720ac3524d9c27a0b8411e23695 @airhorns committed Sep 19, 2011
Showing with 7 additions and 3 deletions.
  1. +2 −2 jobs/autotrader_listings.coffee
  2. +3 −0 lib/busters.coffee
  3. +2 −1 package.json
@@ -3,13 +3,13 @@ coffee = require 'coffee-script'
busters = require '../lib/busters'
@class = class ListingUrls extends busters.Job
- input: ["http://www.autotrader.ca/a/pv/Used/Mercedes-Benz/C-Class/MERCEDESBENZ+CCLASS/?cat2=7%2c11%2c9%2c10&prv=Ontario"]
+ input: ["http://www.autotrader.ca/a/pv/new-used/all/all/MERCEDESBENZ+CCLASS/?lloc=Montreal&cty=Montr%C3%A9al&prv=Quebec&ctr=Canada&vpt=45.2805939614465%2c-73.9935797136234%2c45.7441213336412%2c-73.115225875408%2c&prx=100&"]
run: (url) ->
@getHtml url, (err, $) =>
return @exit err if err?
results = []
$('.carlink').each (e) =>
- results.push "http://www.autotrader.ca#{escape e.attribs.href}"
+ results.push "http://www.autotrader.ca#{busters.linkify e.attribs.href}"
@emit results
null
View
@@ -1,5 +1,6 @@
mongoose = require 'mongoose'
nodeio = require 'node.io'
+ent = require 'ent'
mongoose.connect 'mongodb://localhost/busters'
@@ -17,6 +18,8 @@ ListingSchema = new mongoose.Schema
exports.Listing = mongoose.model 'Listing', ListingSchema
+exports.linkify = (x) ->
+ escape ent.decode x
exports.Job = class Job extends nodeio.JobProto
constructor: ->
super
View
@@ -12,7 +12,8 @@
"dependencies": {
"coffee-script": ">=0.0.0",
"node.io": ">=0.0.0",
- "mongoose": ">=0.0.0"
+ "mongoose": ">=0.0.0",
+ "ent": ">0.0.0"
},
"devDependencies": {}
}

0 comments on commit a5ac5b3

Please sign in to comment.