Created
February 12, 2015 05:19
-
-
Save dcollien/6c87c09bf9c15e542e44 to your computer and use it in GitHub Desktop.
UrbanSpoon What's for Lunch in Sydney CBD?
This file contains 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
request = require 'request' | |
lastLunches = '' | |
module.exports = (callback) -> | |
request { | |
url: "http://www.urbanspoon.com/api/ispin?p=1&n=7003&r=#{lastLunches}&l=70&v=6f" | |
}, (err, msg, data) -> | |
fields = (data.split '\t') | |
restaurantID = fields[0] | |
name = "<b><a href=\"#{fields[12]}\">" + fields[1] + "</a></b>" | |
address = fields[3] + ' ' + fields[4] + ' ' + fields[5] + ' ' + fields[6] | |
lat = fields[16] | |
long = fields[17] | |
mapLink = '<a href="http://maps.google.com/?q=' + lat + ',' + long + '">Map</a>' | |
if lastLunches.length > 1024 | |
lastLunches = '' | |
lastLunches += '%2C' + restaurantID | |
callback | |
format: 'html' | |
output: name + '<br>' + address + '<br>' + fields[20] + '<br>' + mapLink | |
color: 'green' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment