add matemat scraper
This commit is contained in:
parent
548d117934
commit
5f0540def3
|
@ -26,4 +26,5 @@ in {
|
|||
xerox = wrapScript "xerox" ./xerox/scrape.rb;
|
||||
luftdaten = wrapScript "luftdaten" ./luftdaten/scrape.rb;
|
||||
fhem = wrapScript "fhem" ./fhem/scrape.rb;
|
||||
matemat = wrapScript "matemat" ./matemat/scrape.rb;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'open-uri'
|
||||
require 'json'
|
||||
require 'influxdb'
|
||||
|
||||
points = []
|
||||
|
||||
data = JSON.parse open("http://matemat.hq.c3d2.de/statistics.json", :http_basic_authentication => ['k-ot', 'k-ot']).read()
|
||||
points.push({
|
||||
series: 'statistics',
|
||||
values: data,
|
||||
})
|
||||
|
||||
data = JSON.parse open("http://matemat.hq.c3d2.de/summary.json", :http_basic_authentication => ['k-ot', 'k-ot']).read()
|
||||
data.each do |d|
|
||||
points.push({
|
||||
series: 'summary',
|
||||
tags: {
|
||||
name: d["name"],
|
||||
},
|
||||
values: {
|
||||
price: d["price"],
|
||||
value: d["value"],
|
||||
volume: d["volume"],
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
db = InfluxDB::Client.new(url: "http://grafana.hq.c3d2.de:8086/matemat")
|
||||
db.write_points(points, 'm')
|
Loading…
Reference in New Issue