简体   繁体   English

从磁铁Uri获取信息

[英]Getting Info from a Magnet Uri

I am attempting to extract information from a magnet uri. 我正在尝试从磁铁uri中提取信息。 For example I want to know the filename and the size of the file from a magnet uri. 例如,我想知道磁铁uri的文件名和文件大小。 I know this can be done just by looking at the url and checking the dn and xl parameters of the magnet uri. 我知道这可以通过查看URL并检查磁铁uri的dn和xl参数来完成。

But what if those parameters and not provided? 但是,如果没有提供这些参数怎么办? uTorrent seems to accept those links without dn and xl parameters and eventually fills it out by itself. uTorrent似乎接受不带dn和xl参数的那些链接,并最终自行填写。

Is there a way similar to extracting info from a magnet uri like a .torrent file? 有没有一种类似于从磁力uri(如.torrent文件)中提取信息的方法? The way I extract info from a torrent file is by either scraping the url or opening and reading the .torrent file content. 我从torrent文件中提取信息的方式是通过抓取url或打开并阅读.torrent文件内容。 If there a way i could do something similar with a magnet file? 如果有办法我可以对磁性文件做类似的事情?

I am attempting to code this in php. 我正在尝试用php编写代码。

Thanks! 谢谢!

If I'm correct uTorrent just gets the .torrent file using DHT from the swarm. 如果我是正确的,uTorrent只是使用DHT从群集中获取.torrent文件。 Magnet links are basically a way to torrent the torrent file (if that makes sense). 磁力链接基本上是对种子文件进行种子发布的一种方式(如果可以的话)。

You could use a PHP torrent client though. 您可以使用PHP torrent客户端

You would have to actually connect to the xs , as , mt , or tr address and ask that source about the file. 您实际上必须连接到xsasmttr地址,并向该来源询问文件。

The remote end could be an HTTP fileserver or a P2P network address, so doing this right would consist of writing a rudimentary torrent client (and a crippled one, since it probably wouldn't support DHT peer-finding and caching). 远程端可以是HTTP文件服务器或P2P网络地址,因此要执行此操作将包括编写一个基本的Torrent客户端(以及一个残废的torrent客户端,因为它可能不支持DHT对等查找和缓存)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM