17 lines
		
	
	
	
		
			626 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			17 lines
		
	
	
	
		
			626 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
								 | 
							
								<script src="/webtorrent.js"></script>
							 | 
						||
| 
								 | 
							
								<div id="wtmedia">
							 | 
						||
| 
								 | 
							
								</div>
							 | 
						||
| 
								 | 
							
								<script>
							 | 
						||
| 
								 | 
							
								    const client = new WebTorrent(tracker=false,dht=true,webSeeds=true);
							 | 
						||
| 
								 | 
							
								    const magnetURI = '{{.Get 0}}';
							 | 
						||
| 
								 | 
							
								    client.add(magnetURI, function (torrent) {
							 | 
						||
| 
								 | 
							
								        // Got torrent metadata!
							 | 
						||
| 
								 | 
							
								        console.log('Client is downloading:', torrent.infoHash)
							 | 
						||
| 
								 | 
							
								        torrent.files.forEach(function (file) {
							 | 
						||
| 
								 | 
							
								            // Display the file by appending it to the DOM. Supports video, audio, images, and
							 | 
						||
| 
								 | 
							
								            // more. Specify a container element (CSS selector or reference to DOM node).
							 | 
						||
| 
								 | 
							
								            file.appendTo('#wtmedia')
							 | 
						||
| 
								 | 
							
								        })
							 | 
						||
| 
								 | 
							
								    })
							 | 
						||
| 
								 | 
							
								</script>
							 |