Untitled
3 years ago in Plain Text
<html>
<body>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script>
var client = new WebTorrent()
client.add('https://webseed.btorrent.xyz/juanpabloaj/other-page.torrent', function (torrent) {
// Got torrent metadata!
console.log('Client is downloading:', torrent.infoHash)
torrent.files[0].getBlobURL(function(err, url) {
if (err) return console.log(err)
var a = document.createElement('a')
a.target = '_blank'
a.download = torrent.files[0].name
a.href = url
a.textContent = 'Download ' + torrent.files[0].name
document.body.appendChild(a)
})
})
</script>
</body>
</html>