Skip to content

Commit cf0b22b

Browse files
committed
Update example for new API
Fix webtorrent#166
1 parent f76b27c commit cf0b22b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

examples/tracker-scrape.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ npm install browserify parse-torrent bittorrent-tracker
1212
var Tracker = require('bittorrent-tracker')
1313
var magnet = require('magnet-uri')
1414

15-
// These values don't matter
16-
var peerId = new Buffer('01234567890123456789')
17-
var port = 6889
18-
1915
var magnetURI = "magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4"
2016

2117
var parsedTorrent = magnet(magnetURI)
22-
var client = new Tracker(peerId, port, parsedTorrent)
18+
19+
var opts = {
20+
infoHash: parsedTorrent.infoHash,
21+
announce: parsedTorrent.announce,
22+
peerId: new Buffer('01234567890123456789'), // hex string or Buffer
23+
port: 6881 // torrent client port
24+
}
25+
26+
var client = new Tracker(opts)
2327

2428
client.scrape()
2529

0 commit comments

Comments
 (0)