javascript - 不通过磁力链接下载文件
问题描述
这是文档中的一个示例。
var client = new WebTorrent()
var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&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%2Fsintel.torrent'
client.add(torrentId, function (torrent) {
// Torrents can contain many files. Let's use the .mp4 file
//var file = torrent.files.find(function (file) {
//return file.name.endsWith('.mp4')
//})
// no console.log !!
console.log(torrent)
// Display the file by adding it to the DOM. Supports video, audio, image, etc. files
torrent.files[0].appendTo('body')
})
一个例子效果很好。但是,如果我将磁铁链接更改为另一个,但没有任何反应。我要更改的链接是有效的。
magnet:?xt=urn:btih:C45CE38E4508E775E49EB2A6841C814D1A8AD375&tr=http%3A%2F%2Fbt3.t-ru.org%2Fann%3Fmagnet
但不适用于此链接。没有一个错误或什么都没有
解决方案
我最近遇到了类似的问题,试图解决这个问题。只有 Instant.io(使用轮流服务器)始终有效。对我有用的东西很少webRTC
。
我认为WebTorrent
作品提供的模板而不是其他模板的原因是因为该模型包含一个磁铁,该磁铁具有指向其网站上 torrent 文件的链接。
我怀疑他们正在播种,甚至只是通过其他方式提供它。
xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent
创建 Instant.io 的人采用了网络种子模板并使其工作。WebRTC
绝对是一场噩梦,网络洪流模板/网站甚至没有WebSocket
正确连接(至少对我而言)。
如果您希望传递相对少量的数据,那么通过您WebSockets
的中继更易于管理。
如果你想创建类似的东西WebTorrent
,可以查看 Instant.io 的 Github。您需要设置服务器并配置转弯服务器。WebRTC
就像在 1992 年尝试配置显卡一样。祝你好运。
推荐阅读
- python - 拆分日期以创建各种时间序列
- android - ViewModel 架构困境
- docker - 如何将传播从 rprivate 更改为 rshared?
- c++ - 尝试访问 Qt 中的表单元素时出错
- r - 混合效应机器学习回归模型
- android - 我无法在 Android Studio 中同步我的 kotlin gradle
- c# - ASP.Net Core MVC - 仅在摘要中显示自定义验证错误
- flutter - Flutter sqflite:热重载后数据库不稳定
- typescript - “typeof Sequelize”类型上不存在属性“Op”
- email - 避免“强制使用”Microsoft Outlook 客户端