发送刮伤请求获取洪流的种子和同伴 [英] Sending scrape request for getting torrent's seeds and peers
问题描述
我一直试图创建一个洪流网站,但我坚持以下。
如何发送torrent scrape请求以获取其播种器和leechers?
我有一个PHP类函数,它提供了公告列表。
public function getTrackers(){
//加载跟踪器列表
$ trackerlist = array();
if($ this-> torrent-> get_value('announce-list'))
{
$ trackers = $ this-> torrent-> get_value ( '宣布列表') - > get_plain();
while(list($ key,$ value)= each($ trackers))
{
if(is_array($ value-> get_plain())){
while (列表($ key,$ value2)= each($ value2))
{
while(list($ key,$ value3)= each($ value2))
{
array_push($ trackerlist,$ value3-> get_plain());
}
}
} else {
array_push($ trackerlist,$ value-> get_plain());
$ b else if($ this-> torrent-> get_value('announce'))
{
array_push($ trackerlist,$ this-> torrent-> get_value('announce') - > get_plain());
}
返回$ trackerlist;
}
此代码基于由 bencode.php编码的数据即可。如何显示每个连续发布网址的种子和同伴?
Annouce网址|种子:没有|同行:不,
Annouce网址|种子:没有|同行:不,
Annouce网址|种子:没有| Peers:No.
等.....
由于我在PHP方面的经验有限,因此我无法帮助您编写代码,但处理HTTP跟踪程序应该相当简单。
获取通告URL搜索并用scrape替换单词announce,并添加?infohash =< url-encoded-binary-20-byte-long-infohash>
作为参数(你可以在你的查询中添加任意数量的 infohash =
,除以&符号。对所得到的URL进行HTTP调用,并阅读你的代码解答,它将包含所有请求的信息 - 它们各自的下载内容,播种器(跟踪器词汇表中的'完整')和leechers('未完成的')。HTTP抓取是非常有用的。
处理UDP跟踪器比较复杂,因为这种二进制形式的通信发生在很多地方检查 UDP跟踪协议的完整描述。
I have been trying to create a torrent site but I'm stuck with the following. How to send torrent scrape request to get its seeder and leechers?
I have a PHP class function that provides me announce list.
public function getTrackers() {
// Load tracker list
$trackerlist = array();
if ( $this->torrent->get_value('announce-list') )
{
$trackers = $this->torrent->get_value('announce-list')->get_plain();
while ( list( $key, $value ) = each( $trackers ) )
{
if ( is_array( $value->get_plain() ) ) {
while ( list( $key, $value2 ) = each( $value ) )
{
while ( list( $key, $value3 ) = each( $value2 ) )
{
array_push( $trackerlist, $value3->get_plain() );
}
}
} else {
array_push( $trackerlist, $value->get_plain() );
}
}
}
else if ( $this->torrent->get_value('announce') )
{
array_push( $trackerlist, $this->torrent->get_value('announce')->get_plain() );
}
return $trackerlist;
}
This code is based on the data encoded by the bencode.php. How to show Seeds and Peers of every consecutive announce url like this?
Annouce Url | Seeds : No. | Peers: No.
Annouce Url | Seeds : No. | Peers: No.
Annouce Url | Seeds : No. | Peers: No.
and so on.....
I can't help you with code, due to my limited experience with PHP, but dealing with HTTP trackers should be fairly easy.
Get the announce URL, search and replace the word "announce" with "scrape" and add ?infohash=<url-encoded-binary-20-byte-long-infohash>
as parameter (you may add as many infohash=
to your query, divided by ampersand. Make a HTTP call to that resulting URL and read your bencoded answer. It will contain all the requested info-hashes with their respective downloads, seeders ('complete' in tracker's vocabulary) and leechers ('incomplete'). HTTP scrape is very well documented.
Dealing with UDP trackers is somewhat more complicated, because this binary form of communication happens at much lower level. Check the full description of UDP tracker protocol.
这篇关于发送刮伤请求获取洪流的种子和同伴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!