2022-12-25 16:23:07 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-01-03 22:26:31 +08:00
|
|
|
|
2022-12-25 16:23:07 +08:00
|
|
|
"github.com/anacrolix/torrent"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
config := torrent.NewDefaultClientConfig()
|
|
|
|
config.DataDir = "./output"
|
|
|
|
c, _ := torrent.NewClient(config)
|
|
|
|
defer c.Close()
|
|
|
|
t, _ := c.AddMagnet("magnet:?xt=urn:btih:99c82bb73505a3c0b453f9fa0e881d6e5a32a0c1&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce")
|
|
|
|
<-t.GotInfo()
|
|
|
|
fmt.Println("start downloading")
|
|
|
|
t.DownloadAll()
|
|
|
|
c.WaitAll()
|
2023-01-03 22:26:31 +08:00
|
|
|
}
|