From ed7b62d9d2e5691fa20fd9aa9a6a43a024d0e3b2 Mon Sep 17 00:00:00 2001 From: Gabriel Garrido Date: Mon, 22 Apr 2024 10:11:53 +0200 Subject: [PATCH] Skip direct or private posts --- client/client.go | 4 ++++ main.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/client/client.go b/client/client.go index c6d01cd..4d50846 100644 --- a/client/client.go +++ b/client/client.go @@ -148,3 +148,7 @@ func get(requestUrl string, variable interface{}) error { return nil } + +func ShouldSkipPost(post Post) bool { + return post.Visibility != "unlisted" && post.Visibility != "public" +} diff --git a/main.go b/main.go index 970fb59..45835c3 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,10 @@ func main() { log.Println(fmt.Sprintf("Fetched %d posts", len(posts))) for _, post := range posts { + if client.ShouldSkipPost(post) { + continue + } + if err := fileWriter.Write(post); err != nil { log.Panicln("error writing post to file: %w", err) break