ferrolho/magnet-player

[solved] Automatically load magnet links via URL

Closed this issue · 0 comments

Adding this to the index.html file let's you use a URL argument to automatically load the magnet link into the player on page load:

<script>
	// Get the URL parameter 'url'
	const urlParam = new URLSearchParams(window.location.search).get('url');

	// Check if the 'url' parameter exists and is not empty
	if (urlParam) {
		// Set the 'url' parameter as the URL hash
		window.location.hash = encodeURIComponent(urlParam);
	}
</script>

eg

http://127.0.0.1:4000/magnet-player/?url={your_magnet_ link}