From ac3aafafeef06bc38d1b980807786e2558edb2cb Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 1 May 2014 14:10:16 +0200 Subject: Ignore selfposts in reddit list --- earthporn.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/earthporn.go b/earthporn.go index ad1864a..9edb837 100644 --- a/earthporn.go +++ b/earthporn.go @@ -11,7 +11,7 @@ import ( type redditList struct { Data struct { Children []struct { - Data EarthPorn `json:"data"` + Data *EarthPorn `json:"data"` } `json:"children"` } `json:"data"` } @@ -20,6 +20,7 @@ type EarthPorn struct { Title string `json:"title"` URL string `json:"url,omitempty"` Permalink string `json:"permalink"` + Domain string `json:"domain"` } const earthPornURL = "http://www.reddit.com/r/EarthPorn.json" @@ -39,6 +40,11 @@ func GetEarthPorn() (EarthPorn, error) { for _, el := range list.Data.Children { p := el.Data + + if p.Domain == "self.EarthPorn" { + continue + } + if p.URL == "" { continue } -- cgit v1.2.3-70-g09d2