Created
July 2, 2024 18:56
-
-
Save julenwang/6441fa6a23b1458413d915db500cc648 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name copyNyaaMagnets | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-07-02 | |
// @description try to take over the world! | |
// @author Julen | |
// @match https://nyaa.si/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=nyaa.si | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
let nav = document.querySelector('nav'); | |
if (nav) { | |
let btn = document.createElement('button'); | |
btn.type = 'button'; | |
btn.textContent = 'copy所有磁力链'; | |
nav.append(btn); | |
btn.onclick = () => { | |
let result = Array.from(document.querySelectorAll('.table-responsive tbody td a[href^="magnet"]')) | |
.map((ele) => { | |
return ele.href; | |
}) | |
.reduce((acc, cur) => { | |
return `${acc}${cur}\n`; | |
}, ''); | |
window.navigator.clipboard.writeText(result); | |
}; | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment