How to use the bittorrent-tracker.scrape function in bittorrent-tracker

To help you get started, we’ve selected a few bittorrent-tracker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qqdaiyu55 / YanQi / src / client / containers / VideoPage.js View on Github external
}).done((data)=>{
      this.setState({
        data: {
          title: data.title,
          backdrop: data.backdrop,
          tags: data.tags,
          rscInfo: data.rsc_info,
          introduction: data.introduction
        }
      })

      var infoHash = data.rsc_info.map((r) => {
        return r[2].split('magnet:?xt=urn:btih:')[1].split('&')[0]
      })
      var seeders = new Array(infoHash.length).fill(0)
      Tracker.scrape({ announce: this.announce, infoHash: infoHash }, ((err, results) => {
        if (err) {
          throw err
          return
        }
        if (infoHash.length > 1) {
          var i
          for (i = 0; i < infoHash.length; i++) {
            seeders[i] = results[infoHash[i]].complete
          }
        } else {
          seeders[0] = results.complete
        }
        this.setState({ seeders: seeders })
      }).bind(this))
    }).fail(()=>{
      console.log("There has an error.")
github AlphaReign / scraper / src / scraper.js View on Github external
scrape (hashes) {
		const requiredOpts = {
			announce: [this.config.tracker],
			infoHash: hashes
		};

		Client.scrape(requiredOpts, (error, results) => {
			if (error) {
				console.log(error);
				setTimeout(() => {
					this.run();
				}, 5000);
			} else {
				console.log('Scrape Successful');
				this.update(results);
			}
		});

	}
github AlphaReign / scraper / src / tracker.js View on Github external
const results = await new Promise((resolve, reject) => {
			Client.scrape(options, (error, data) => (error ? reject(error) : resolve(data)));
		});

bittorrent-tracker

Simple, robust, BitTorrent tracker (client & server) implementation

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis