- Notifications
You must be signed in to change notification settings - Fork3
Go library to scrape torrents on any UDP tracker
License
NotificationsYou must be signed in to change notification settings
etix/goscrape
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This library partially implementBEP-0015and returns the number ofseeders,leechers andcompleted downloads for a given infohash list.
Usage:
go get -u github.com/etix/goscrape
Example:
// Create a new instance of the library and specify the torrent tracker to use.s,err:=goscrape.New("udp://tracker.kali.org:6969/announce")iferr!=nil {log.Fatal("Error:",err)}// A list of infohash to scrape, at most 74 infohash can be scraped at once.// Be sure to provide infohash that are 40 hexadecimal characters long only.infohash:= [][]byte{ []byte("176e2a9696092482d4acdef445b53ffcebb56960"), []byte("e80cb87fbd938f3b1e47db64c10c3ab04ad49987"), []byte("04098e49061bedb3f2d8f90204bf239019d198d9"),}// Connect to the tracker and scrape the list of infohash in only two UDP round trips.res,err:=s.Scrape(infohash...)iferr!=nil {log.Fatal("Error:",err)}// Loop over the results and print them.// Result are guaranteed to be in the same order they were requested.for_,r:=rangeres {fmt.Println("Infohash:\t",string(r.Infohash))fmt.Println("Seeders:\t",r.Seeders)fmt.Println("Leechers:\t",r.Leechers)fmt.Println("Completed:\t",r.Completed)fmt.Println("")}
Result:
Infohash: 176e2a9696092482d4acdef445b53ffcebb56960Seeders: 3053Leechers: 248Completed: 44171Infohash: e80cb87fbd938f3b1e47db64c10c3ab04ad49987Seeders: 376Leechers: 20Completed: 4161Infohash: 04098e49061bedb3f2d8f90204bf239019d198d9Seeders: 100Leechers: 6Completed: 703