Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get peers uploaded/download info (seeders/leechers) #1255

Closed
francoism90 opened this issue Jan 5, 2018 · 10 comments
Closed

Get peers uploaded/download info (seeders/leechers) #1255

francoism90 opened this issue Jan 5, 2018 · 10 comments
Labels

Comments

@francoism90
Copy link

@francoism90 francoism90 commented Jan 5, 2018

What version of WebTorrent?
0.98.20

What operating system and Node.js version?
Linux

What browser and version? (if using WebTorrent in the browser)
/

What did you expect to happen?
To get the seed/peers stats

What actually happened?
Empty

var WebTorrent = require('webtorrent')

var client = new WebTorrent()
var torrentId = 'magnet:?xt=urn:btih:40448d478d9203a3919b0900e7fbb9e8748dcdf9'
var torrent = client.add(torrentId, {}, onseed)

torrent.on('wire', function (wire, addr) {
    console.log(wire.uploaded)
    console.log(wire.isSeeder)
})

function onseed (torrent) {
    console.log('onseed getting called')
}

What I'm I doing wrong?

Thanks!

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 5, 2018

.uploaded is empty? not even 0?

.isSeeder doesn't exist: https://github.com/webtorrent/bittorrent-protocol/blob/master/index.js

@francoism90

This comment has been minimized.

Copy link
Author

@francoism90 francoism90 commented Jan 5, 2018

@DiegoRBaquero It's indeed 0 - but for all peers. Tried multiple (valid) magnets.

torrent.on('ready', function() {
    console.log('Peers', torrent.numPeers)
})

torrent.on('wire', function (wire, addr) {
    console.log('Downloaded', wire.downloaded)
    console.log('Uploaded', wire.uploaded)
    console.log('Download Speed', wire.downloadSpeed())
    console.log('Upload Speed', wire.uploadSpeed())
})

Log:

..
Downloaded 0
Uploaded 0
Download Speed 0
Upload Speed 0
Downloaded 0
Uploaded 0
Download Speed 0
Upload Speed 0
onseed getting called
Peers 113
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 5, 2018

Looks correct to me, when a peer has just connected, it hasn't downloaded or uploaded anything to the client, and speed is 0 as it hasn't started the transfer. Seems about right

@francoism90

This comment has been minimized.

Copy link
Author

@francoism90 francoism90 commented Jan 5, 2018

Yeah, but even after waiting for 30min. nothing happens, only the zero's are showing.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 5, 2018

torrent.on('wire', cb) only gets called when the wire connects. You are seeing all the logs when peers connect, but that's it.

@francoism90

This comment has been minimized.

Copy link
Author

@francoism90 francoism90 commented Jan 5, 2018

@DiegoRBaquero Hmm, would it be possible to scrape the seeds/peers on the DHT?
I'm I missing a method? I wish to get the peers/seeds amount as qBt does (without trackers, only DHT).
Would that be possible?

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 5, 2018

Doesn't seem like it would be possible. https://github.com/webtorrent/bittorrent-dht doesn't support getting whether a peer is seeder/leecher.

@francoism90

This comment has been minimized.

Copy link
Author

@francoism90 francoism90 commented Jan 5, 2018

@DiegoRBaquero Could you tell me how is it possible for qBt to get the number of Seeds/Peers? I'm trying to see how they do it. :)

bittorrent-dht works, but is it possible to get the down speed/downloaded of this too?

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Jan 5, 2018

I don't know anything about qBt, and I'm not proficient in DHT, as I mostly work in the browser part which doesn't have it.

bittorrent-dht works, but is it possible to get the down speed/downloaded of this too?

no, that's only possible with the wire that you are using.

@stale

This comment has been minimized.

Copy link

@stale stale bot commented May 5, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label May 5, 2018
@stale stale bot closed this May 12, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.