diff --git a/retrieve.go b/retrieve.go index e4647fc..c3fcf96 100644 --- a/retrieve.go +++ b/retrieve.go @@ -7,7 +7,7 @@ import ( "html" "io/ioutil" "log" -"io" + "io" "net/http" "strings" "time" @@ -143,12 +143,15 @@ func check_post(uri string) (PostJson, error) { _, err = pool.Exec(context.Background(), "INSERT INTO posts (id, inreplyto, published, summary, content, normalized, attributedto, posthash, instance) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)", postjson.ID, postjson.InReplyTo, postjson.Published, postjson.Summary, postjson.Content, postjson.normalized, postjson.AttributedTo, postjson.posthash, postjson.instance) if err != nil { - // log.Print("INSERT posts error of " + uri + ": ", err) return postjson, err } for _, to := range postjson.To { if to != "https://www.w3.org/ns/activitystreams#Public" && to != "" { + if strings.HasSuffix(to, "/followers") == true { + // This check is very much a bad solution, may consider removing the entire for-loop + continue + } go check_user(to) } } @@ -191,7 +194,7 @@ func check_user(uri string) (UserJson, error) { return userjson, err } -io.Copy(ioutil.Discard, resp.Body) + io.Copy(ioutil.Discard, resp.Body) resp.Body.Close()