开发者问题收集

在 Node 上,通过 Webtorrent 进行播种无法与 webtorrent-hybrid 配合使用

2020-02-03
1392

软件版本: "webtorrent-hybrid": "^4.0.1",

OS X 10.14.4

NPM: 6.13.4

Node: v8.17.0

var WebTorrent = require('webtorrent-hybrid')

var client = new WebTorrent()

client.on('error', (err) => {
  console.error(`fatalError ${err.message || err}`);
  process.exit(1);
});

client.seed('./c5l.mp4', function (torrent) {
  torrent.on('warning', function (err) {
    console.warn(err);
  });
  torrent.on('error', function (err) {
    console.error(err);
  });

  console.log('client.seed done', {
    magnetURI: torrent.magnetURI,
    ready: torrent.ready,
    paused: torrent.paused,
    done: torrent.done,
    infohash: torrent.infoHash
  });
});

给我我的磁力串。在前端我有:

script(src = 'https://cdnjs.cloudflare.com/ajax/libs/webtorrent/0.107.17/webtorrent.min.js')

script.
  var client = new WebTorrent()


// working torrentId
  var torrentId2 = 'magnet:?xt=urn:btih:c9e15763f722f23e98a29decdfae341b98d53056&dn=Cosmos+Laundromat&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fcosmos-laundromat.torrent'

// failing torrentId
  var torrentId5 = 'magnet:?xt=urn:btih:f9435fb103d53a0b3cce14afbae867cc6999d76b&dn=c5l.mp4&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.openwebtorrent.com'

  client.add(torrentId5, function (torrent) {
    // Torrents can contain many files. Let's use the .mp4 file
    var file = torrent.files.find(function (file) {
      console.log(file);

      return file.name.endsWith('.mp4')
    })

    // Display the file by adding it to the DOM.
    // Supports video, audio, image files, and more!
    file.appendTo('body')
  })

当我有可用的 torrentId 时,视频会按预期加载。当我使用通过 webtorrent-hybrid 包创建的磁铁网址将其替换时,我首先收到一些错误:

与 'wss://tracker.fastcast.nz/' 的 WebSocket 连接失败:建立连接时出错:net::ERR_NAME_NOT_RESOLVED

太好了,所以我从查询字符串中删除了该跟踪器,请重试:

与 'wss://tracker.btorrent.xyz/' 的 WebSocket 连接失败:原因不明

太好了,再次删除它,我得到了一些挂起的东西,什么也没发生。

如果我在 Brave 上使用磁铁,它只会挂在 加载种子文件列表 处,并且旋转器无休止地旋转。

发生了什么?谢谢

2个回答
// working torrentId
var torrentId2
magnet:?xt=urn:btih:c9e15763f722f23e98a29decdfae341b98d53056&dn=Cosmos+Laundromat&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fcosmos-laundromat.torrent

是种子良好的文件,意味着其工作率为 90-100%

// failing torrentId
var torrentId5 = 'magnet:?xt=urn:btih:f9435fb103d53a0b3cce14afbae867cc6999d76b&dn=c5l.mp4&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.openwebtorrent.com'

不是或种子较低的文件,意味着其工作率为 0.1-10%

Joseph Morales
2020-07-09

When I have the working torrentId the video loads as expected. When I sub it out with the magnet url that was created via the webtorrent-hybrid package I first get some errors:

WebSocket connection to 'wss://tracker.fastcast.nz/' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

Great, so I remove that tracker from the querystring, try again:

WebSocket connection to 'wss://tracker.btorrent.xyz/' failed: Unknown reason

Great, remove it again I get something that just hangs and nothing happens.

If I use the magnet on Brave it just hangs at Loading the torrent file list and the spinner endlessly spins.

What's going on? Thanks

与 'wss://tracker.fastcast.nz/' 的 WebSocket 连接失败:连接建立时出错:net::ERR_NAME_NOT_RESOLVED

wss://tracker.fastcast.nz/ 已失效,所有者已于 2019 年停止提供支持

与 'wss://tracker.btorrent.xyz/' 的 WebSocket 连接失败:原因不明 是一个繁忙的跟踪器,响应时间太长,并且由于资金不足而在廉价服务器上运行。因此它的工作率为 30-90%。因此结果为 失败:未知原因

If I use the magnet on Brave it just hangs at Loading the torrent file list and the spinner endlessly spins.

Webtorrent 客户端在下载/播放大型文件和不支持的文件格式(如 .mkv (video/x-Matroska) )时会遇到一些问题。如果出现错误,您将看不到任何通知。它只是挂断了。

Joseph Morales
2020-07-09