Skip to content

Instantly share code, notes, and snippets.

@peko
Created June 6, 2015 18:49
Show Gist options
  • Save peko/a21677c48975187c6e43 to your computer and use it in GitHub Desktop.
Save peko/a21677c48975187c6e43 to your computer and use it in GitHub Desktop.
grab = (tag)->
console.log "grab #{tag}"
min_id = 0
#min_id = if lastid[tag] then lastid[tag] else 0
# console.log "https://api.instagram.com/v1/tags/#{tag}/media/recent?client_id=#{cid}&client_secret=#{sec}&max_id=#{min_id}"
options =
hostname: "api.instagram.com"
path : "/v1/tags/#{tag}/media/recent?client_id=#{cid}&client_secret=#{sec}&min_id=#{min_id}"
port : 443
method : "GET"
https.get options, (res)->
# console.log res
# console.log 'STATUS: ' + res.statusCode
# console.log 'HEADERS: ' + JSON.stringify(res.headers)
data = ""
res.on "data" , (chunk) -> data+=chunk
res.on "end" , -> processing tag, data
res.on "error", (err) -> console.log err.message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment