Skip direct or private posts

This commit is contained in:
Gabriel Garrido 2024-04-22 10:11:53 +02:00
parent 6f6949db37
commit ed7b62d9d2
2 changed files with 8 additions and 0 deletions

View file

@ -148,3 +148,7 @@ func get(requestUrl string, variable interface{}) error {
return nil return nil
} }
func ShouldSkipPost(post Post) bool {
return post.Visibility != "unlisted" && post.Visibility != "public"
}

View file

@ -50,6 +50,10 @@ func main() {
log.Println(fmt.Sprintf("Fetched %d posts", len(posts))) log.Println(fmt.Sprintf("Fetched %d posts", len(posts)))
for _, post := range posts { for _, post := range posts {
if client.ShouldSkipPost(post) {
continue
}
if err := fileWriter.Write(post); err != nil { if err := fileWriter.Write(post); err != nil {
log.Panicln("error writing post to file: %w", err) log.Panicln("error writing post to file: %w", err)
break break