M
M
More11o2018-07-04 15:14:12
PHP
More11o, 2018-07-04 15:14:12

Get the number of seeds/peers of a torrent?

With the help of the torrent-rw library, I was able to get information about the torrent file: list of announcers, hash info, file size, etc.
Now I need to get the number of seeds/peers from the announcers.
I know that I need to send a GET request to the announcer and pass the hash sum. Can someone help me correctly form the request and decrypt the received data?
UPD
Having rummaged in the torrent-rw library, I found the scrape function there. It seems like it is responsible for displaying statistics, but when it is called, I get the following array in response:

{ [" [2001:67c:28f8:92::1111:1]:2710 "]=> string(29) "Tracker request timeout (30s)" [" ipv6.leechers-paradise.org:6969 "]=> string(29) "Tracker request timeout (30s)" [" tracker.filetracker.pl:8089/scrape "]=> string(29) "Tracker request timeout (30s)" [" tracker2.wasabii.com.tw:6969 /scrape "]=> string(29) "Tracker request timeout (30s)" [" 46.148.18.250:2710 "]=> string(29) "Tracker request timeout (30s)" [" retracker.local/scrape "] => string(29) "Tracker request timeout (30s)" [" tracker.grepler.com:6969/scrape "]=> string(29) "Tracker request timeout (30s)" [" opentor.org:2710 "]=> string(29) "Tracker request timeout (30s)" ["87.248.186.252:8080/scrape "]=> string(29) "Tracker request timeout (30s)" [" 125.227.35.196:6969/scrape "]=> string(29) "Tracker request timeout (30s)" [" tracker.tiny-vps.com:6969/scrape "]=> string(29) "Tracker request timeout (30s)" [" 210.244.71.25:6969/scrape "]=> string(29) "Tracker request timeout (30s) )" [" 46.4.109.148:6969/scrape "]=> string(29) "Tracker request timeout (30s)" [" tracker.dler.org:6969/scrape "]=> string(29) "Tracker request timeout (30s)" } )

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Skobkin, 2018-07-04
@skobkin

This is not such an easy task as it might seem.
First, the distribution can be without a tracker. Secondly, if there is a tracker there, it may not show all peers for it.
The most correct (in terms of displaying the correct values) solution would be to ask the tracker for a list of peers if there is a tracker, and then supplement this list with the result of a DHT poll. But this is already a much longer and much less trivial task than a GET request. Here you already have to work with the BitTorrent protocol.
By the way, the announcer can also work not via HTTP. So even if we discard the DHT clarification, one GET may not be enough.

M
MaxPyane, 2018-10-12
@MaxPyane

Here is either for the correct decoding of the contents of the torrent file
https://github.com/christeredvartsen/php-bittorrent
And to get statistics, google something like udp/http scrapers. There, the principle is simple sending packets through sockets, you can even write it yourself, 100 lines maximum, everything is intuitive, you send a request, look at what comes in, decrypt, the main thing is to correctly decode the file so that the hash code is correct because you will never find peers or you will find incorrect peers))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question