snippets

copy all magnet links on a page

i am an avid torrenter, and so sometimes in my torrenting adventures, i’ll do a search for something i want/need, and find that there is no batch for it; instead, there are only haphazard pieces of a would-be batch. and sometimes there can be a lot of these links!

copy all magnet links

the code is below:

code copied!
	!function(a) {
	var b = document.createElement("textarea"),
	c = document.getSelection();
	b.textContent = a, document.body.appendChild(b), c.removeAllRanges(), b.select(), document.execCommand("copy"), c.removeAllRanges(), document.body.removeChild(b)
}

(Array.from(document.querySelectorAll('a[href*="magnet:?"]')).join("\n\n"));