It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
#!/usr/bin/env ruby
username = "xxxxxxxx"
password = "xxxxxxxxx"
puts "Content-type: text/text\n\n" unless ENV["HTTP_HOST"].nil?
require 'httpclient'
clnt = HTTPClient.new
clnt.set_cookie_store("cookie.dat")
r = clnt.get "https://coinotron.com/coinotron/AccountServlet?action=home"
while r.header.status_code == 302 do
r = clnt.get r.header["Location"][0]
end
clnt.post "https://coinotron.com/coinotron/AccountServlet?action=logon", {"name" => username, "password" => password, "Logon" => "Logon"}
html = clnt.get_content "https://coinotron.com/coinotron/AccountServlet?action=myaccount"
require 'nokogiri'
doc = Nokogiri::HTML.parse html
h = Hash.new
h["worker"] = Hash.new
ltc_cr = ltc_ucf = ltc_c = 0
doc.css("input").each do |i|
ltc_cr = i["value"].to_f if i["name"] == "CurrentRoundRewardsLTC"
ltc_ucf = i["value"].to_f if i["name"] == "UnconfirmedRewardsLTC"
ltc_c = i["value"].to_f if i["name"] == "ConfirmedRewardsLTC"
end
ltc_ct = ltc_cr + ltc_ucf + ltc_c
h["CurrentRoundRewardsLTC"] = ltc_cr
h["UnconfirmedRewardsLTC"] = ltc_ucf
h["ConfirmedRewardsLTC"] = ltc_c
h["TotalRewordsLTC"] = ltc_ct
doc.css("form").each do |f|
if f["action"] == "/coinotron/AccountServlet?action=changeworkercoin"
worker_name = f.xpath("input[@name=\"workername\"]").first["value"]
h["worker"][worker_name] = Hash.new if h[worker_name].nil?
coin = ""
f.css("option").each do |o|
unless o["selected"].nil?
coin = o.text ; break
end
end
h["worker"][worker_name]["coin"] = coin
end
if f["action"] == "/coinotron/AccountServlet?action=changeworkerrewardtype"
worker_name = f.xpath("input[@name=\"workername\"]").first["value"]
h["worker"][worker_name] = Hash.new if h[worker_name].nil?
workerrewardtype = ""
f.css("option").each do |o|
unless o["selected"].nil?
workerrewardtype = o.text ; break
end
end
h["worker"][worker_name]["workerrewardtype"] = workerrewardtype
end
end
doc.css("tr").each do |row|
ct = 0
worker_name = khash = ""
row.children.each do |c|
worker_name = c.text.strip if c.name == "td" and ct == 2
khash = c.text.strip if c.name == "td" and ct == 6
ct +=1
end
next if h["worker"][worker_name].nil?
h["worker"][worker_name]["khash"] = khash
end
#puts h
require 'json'
puts h.to_json
{"CurrentRoundRewardsLTC"=>0.0, "UnconfirmedRewardsLTC"=>0.0, "ConfirmedRewardsLTC"=>2.91905758, "TotalRewordsLTC"=>2.91905758, "idler921.gpu"=>{"coin"=>"LTC", "workerrewardtype"=>"Round based pay per share", "khash"=>"152.2 KH/s"}, "idler921.cpu"=>{"coin"=>"LTC", "workerrewardtype"=>"Pay per share", "khash"=>"45.0 KH/s"}}