pleroma_stats_exporter/main.go
2025-01-30 23:31:50 +05:00

35 lines
588 B
Go

package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
)
type JsonInterface interface{}
func getJson(url string) string {
resp, err := http.Get(url)
if err != nil {
log.Println(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
return string(body)
}
func unmJson(jsonString string) JsonInterface {
var decodedJson JsonInterface
err := json.Unmarshal([]byte(jsonString), &decodedJson)
if err != nil {
log.Println(err)
}
return decodedJson
}
func main() {
fmt.Println(unmJson(getJson("https://pleroma.catgirls.asia/api/v1/instance")))
}