使用webtorrent 下载torrent
webtorrent是类似迅雷qBittorrent的磁力链下载工具,完全使用JavaScript编写能使用浏览器和nodejs中运行详情可查看文档https://webtorrent.
webtorrent 是类似迅雷 qBittorrent 的磁力链下载工具,完全使用JavaScript编写
能使用浏览器和nodejs中运行 详情 可查看文档 https://webtorrent.io/docs
编写代码
安装 npm i webtorrent
const WebTorrent=require("webtorrent")
const client=new WebTorrent();
const torrentId=“magnet:?xt=urn:btih:edbb66624dcb54b15311e054a4cb26902f1c93f1&tr=http://open.acgtracker.com:1096/announce”
const options={
announce:["http://open.acgtracker.com:1096/announce"],//要使用的Torrent跟踪器添加到.Torrent中的列表
path:__driname,//保存的文件路径
}
client.add(torrentId, options,(torrent)=>{
//torrent文件信息
const file = torrent.files.find(function (file) {
return file.name.endsWith('.mp4')
})
})
//获取下载的所有 torrent信息
console.log( client.torrents)
相关文章
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~