|
|
@ -24,9 +24,19 @@ func parseApibayJSON(url string) []Torrent {
|
|
|
|
defer httpresp.Body.Close()
|
|
|
|
defer httpresp.Body.Close()
|
|
|
|
body, err := ioutil.ReadAll(httpresp.Body)
|
|
|
|
body, err := ioutil.ReadAll(httpresp.Body)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Println(err)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var resp []ApibayTorrent
|
|
|
|
var resp []ApibayTorrent
|
|
|
|
err = json.Unmarshal(body, &resp)
|
|
|
|
err = json.Unmarshal(body, &resp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Println(err)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var torrents []Torrent
|
|
|
|
var torrents []Torrent
|
|
|
|
for _, apibayTorr := range resp {
|
|
|
|
for _, apibayTorr := range resp {
|
|
|
|
torrents = append(torrents, Torrent{apibayTorr.Info_hash, apibayTorr.Name, apibayTorr.Size})
|
|
|
|
torrents = append(torrents, Torrent{apibayTorr.Info_hash, apibayTorr.Name, apibayTorr.Size})
|
|
|
|