diff --git a/crawl-rss/tpb.go b/crawl-rss/tpb.go index 71e5a13..3cbe4bb 100644 --- a/crawl-rss/tpb.go +++ b/crawl-rss/tpb.go @@ -24,9 +24,19 @@ func parseApibayJSON(url string) []Torrent { defer httpresp.Body.Close() body, err := ioutil.ReadAll(httpresp.Body) + if err != nil { + log.Println(err) + return nil + } + var resp []ApibayTorrent err = json.Unmarshal(body, &resp) + if err != nil { + log.Println(err) + return nil + } + var torrents []Torrent for _, apibayTorr := range resp { torrents = append(torrents, Torrent{apibayTorr.Info_hash, apibayTorr.Name, apibayTorr.Size})