Comment on Show HN: Visual Search using HNSearch APIparentComments−mopatchesOP15yFor anyone interested, this Ruby code will get you started hacking in the HNSearch API right away. Gets JSON response for @query and puts it into an array of submission hashes (@results):require 'net/http'require 'uri'require 'json'@query = “facebook”url = "http://api.thriftdb.com/api.hnsearch.com/items/_search?q=#{C...doc = Net::HTTP.get URI.parse(url)jdoc = JSON.parse(doc)jdoc["results"].each do |result_hash| @results << result_hash["item"] end
Comments
For anyone interested, this Ruby code will get you started hacking in the HNSearch API right away. Gets JSON response for @query and puts it into an array of submission hashes (@results):
require 'net/http'
require 'uri'
require 'json'
@query = “facebook”
url = "http://api.thriftdb.com/api.hnsearch.com/items/_search?q=#{C...
doc = Net::HTTP.get URI.parse(url)
jdoc = JSON.parse(doc)
jdoc["results"].each do |result_hash|
end