Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upHow to get meta data without downloading? #758
Comments
This comment has been minimized.
This comment has been minimized.
|
What do you mean by metadata? Get the torrent file ? |
This comment has been minimized.
This comment has been minimized.
|
@rom1504 yes |
This comment has been minimized.
This comment has been minimized.
|
I'd guess you could remove the torrent as soon as you have the metadata. var meta = client.add(torrentId)
meta.on('metadata', function (torrent) {
//something something
torrent.destroy()
})I didn't test that though... |
This comment has been minimized.
This comment has been minimized.
|
@Tercus I tried before.But will still download files. |
This comment has been minimized.
This comment has been minimized.
|
The torrent will auto start once metadata is found. What @Tercus suggested is the way to go at this moment |
This comment has been minimized.
This comment has been minimized.
|
I'd also like to be able to get the metadata / full torrent file before downloading the file contents. (I'm working on a fork of webtorrent that includes payments. The torrent file contains some license information needed to pay for the right to download a file. The downloader needs to pay for the license before an uploader will seed the file to them. In order to do this the downloader needs the full torrent file first.) I might work on having a way to block all requests except those for metadata if there isn't a better solution out there. |
This comment has been minimized.
This comment has been minimized.
|
+1 Having this feature would simplify my code so much. |
This comment has been minimized.
This comment has been minimized.
|
@nightwolfz What does your code currently look like? |
This comment has been minimized.
This comment has been minimized.
|
If I'm not mistaken, torrent metadata is sent even when peers are choked (because only "requests" are dropped when choking, whereas extended messages, which are used by ut_metadata, are unaffected). This means that if you want to get the metadata first you should be able to just keep the peer choked until after the |
This comment has been minimized.
This comment has been minimized.
|
@feross I can't speak for @nightwolfz but here is what I'm using to pull and emit metadata:
Having args in wt.add that would disable the creation of the file storage, automatically destroy torrents that are timing out, and deselect all files by default would eliminate most of the above code (the cleanUp, setTimeout, torrent.pause, and file.deselect) and likely reduce the overall resource usage for high volume scraping. In addition the recursive delete aspect of cleaning up the file storage is potentially dangerous to less experienced developers. Here is what I think the simplified code might look like if the features were implemented:
I dunno maybe it makes more sense as a wrapper like webtorrent-metadata or something like that. |
This comment has been minimized.
This comment has been minimized.
|
You can use the Or better yet, use the |
This comment has been minimized.
This comment has been minimized.
|
Thanks to feross, bittorrent-protocol, torrent-discovery and ut_metadata provide all the plumbings you need. First you need torrent-discovery to find peers using infohash only, I implemented a bep9-metadata-dl module using the modules mentioned above with callback and Promise interface, plus timeout and concurrent metadata download connections options. Thanks again to to feross. Without his work, it'll take months if not years to make it work. The following is proof of concept code to fetch ubuntu-16.04.1-server-amd64.iso's metadata:
|
I just want to get meta data only,not download it.