Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dht-infohash-crawler

Crawl the DHT network for resource infohashes

This module partially implements BEP-5 to listen on DHT network for infohashes. It's based on dontcontactme's nodeDHT. The example code shows how to create multipul crawler instances to boost the crawling speed. After getting infohashes from DHT network peers, bep9-metadata-dl can be used to fetch the metadata.

Features

  • Simple API
  • Find peers from the DHT network
  • Node.js event emitter based interface

Install

npm install dht-infohash-crawler

API

createCrawler(opts)

crawler.on('infohash', callbackFn(infohash, peerId, peerAddress) {})

Options are:

{ 
  address: '0.0.0.0',     // Listening address, (default='0.0.0.0') 
  port: 6881,             // Listening port (default=6881)
  kbucketSize: 128,       // Size of kbucket (default=128)
  name: 'crawler'         // Crawler name (default='crawler')
}

Example:

const createCrawler = require('dht-infohash-crawler');

const crawler = createCrawler();
crawler.on('infohash', (infohash, peerId, peerAddress) => {
  console.log(`magnet:?xt=urn:btih:${infohash} peerId: ${peerId} ` + 
    `from ${peerAddress.address}:${peerAddress.port}`);
  }
);

License

MIT © Hong Yan.

About

Crawl the DHT network for resource infohashes

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages