This commit is contained in:
Feross Aboukhadijeh 2020-10-21 13:47:38 -10:00
parent 3cec3fa7d9
commit eb69f8d7ab
3 changed files with 6 additions and 6 deletions

View File

@ -281,8 +281,8 @@ Client.scrape = (opts, cb) => {
opts.infoHash = Array.isArray(opts.infoHash) opts.infoHash = Array.isArray(opts.infoHash)
? opts.infoHash.map(infoHash => { ? opts.infoHash.map(infoHash => {
return Buffer.from(infoHash, 'hex') return Buffer.from(infoHash, 'hex')
}) })
: Buffer.from(opts.infoHash, 'hex') : Buffer.from(opts.infoHash, 'hex')
client.scrape({ infoHash: opts.infoHash }) client.scrape({ infoHash: opts.infoHash })
return client return client

View File

@ -63,8 +63,8 @@ class HTTPTracker extends Tracker {
const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0) const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0)
? opts.infoHash.map(infoHash => { ? opts.infoHash.map(infoHash => {
return infoHash.toString('binary') return infoHash.toString('binary')
}) })
: (opts.infoHash && opts.infoHash.toString('binary')) || this.client._infoHashBinary : (opts.infoHash && opts.infoHash.toString('binary')) || this.client._infoHashBinary
const params = { const params = {
info_hash: infoHashes info_hash: infoHashes

View File

@ -77,8 +77,8 @@ class WebSocketTracker extends Tracker {
const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0) const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0)
? opts.infoHash.map(infoHash => { ? opts.infoHash.map(infoHash => {
return infoHash.toString('binary') return infoHash.toString('binary')
}) })
: (opts.infoHash && opts.infoHash.toString('binary')) || this.client._infoHashBinary : (opts.infoHash && opts.infoHash.toString('binary')) || this.client._infoHashBinary
const params = { const params = {
action: 'scrape', action: 'scrape',