Esempio n. 1
0
func apiScrape(r render.Render, params martini.Params) {
	tresult := Torrent{}
	err = torrentDB.collection.Find(bson.M{"_id": params["btih"]}).One(&tresult)
	if err != nil {
		r.JSON(404, map[string]interface{}{"message": "Torrent not found."})
		return
	}
	result := goscrape.Single(tresult.Details, []string{params["btih"]})[0]
	multiUpdate([]goscrape.Result{result})
	r.JSON(200, map[string]interface{}{"Swarm": map[string]interface{}{"Seeders": result.Seeders, "Leechers": result.Leechers}, "Lastmod": time.Now()})
}
Esempio n. 2
0
func apiScrape(r render.Render, params martini.Params) {
	result := goscrape.Single(trackers, []string{params["btih"]})[0]
	multiUpdate([]goscrape.Result{result})
	r.JSON(200, map[string]interface{}{"Swarm": map[string]interface{}{"Seeders": result.Seeders, "Leechers": result.Leechers}, "Lastmod": time.Now()})
}