Added Genre

This commit is contained in:
Shiny Nematoda
2022-07-09 10:59:06 +00:00
parent 27d3562f01
commit 6a5f1d4b7a
7 changed files with 284 additions and 244 deletions
+18 -1
View File
@@ -2,10 +2,25 @@ package main
import (
"fmt"
"github.com/tidwall/gjson"
"net/url"
"strings"
"time"
)
func RunsText(j gjson.Result) string {
var s []string
a := j.Get("runs.#.text").Array()
for i := 0; i < len(a); i++ {
s = append(s, a[i].String())
}
return strings.Join(s, "")
}
func ParseUrl(raw string) (string, error) {
u, err := url.Parse(raw)
@@ -24,7 +39,9 @@ func ParseUrl(raw string) (string, error) {
}
func ErrorMessage(err error) string {
return fmt.Sprintf("{\"error\": \"%s\", \"message\": \"Please Report this error\"}", err)
data := url.QueryEscape(err.Error())
fmt.Println(err)
return fmt.Sprintf("{\"error\":\"%s\",\"message\":\"Got Error: %s\"}", data)
}
func calc(url string) func() {