-
-
Save Ravencentric/b90c11d4c5d5b8947ea0652a322926c0 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 Copy Filelist | |
| // @namespace Violentmonkey Scripts | |
| // @match https://animebytes.tv/torrents.php | |
| // @grant none | |
| // @version 1.0 | |
| // @author Marek | |
| // @description 11/10/2023, 4:38:44 PM | |
| // ==/UserScript== | |
| (async()=>{ | |
| async function getFromAPI() { | |
| let group_id = document.querySelector(`input[name="thread"]`).value; | |
| let torrent_key = document.querySelector("head > link[href*='rss_torrents_all']").href.split("/") | |
| torrent_key = torrent_key[torrent_key.length - 1] | |
| let username = document.querySelector("a.username").innerText | |
| let api_url = `https://animebytes.tv/scrape.php?torrent_pass=${torrent_key}&username=${username}&hentai=0&type=anime&tags=abg-${group_id}` | |
| return (await (await fetch(api_url)).json()).Groups[0] | |
| } | |
| function copyFilelist(tid) { | |
| let torrent = data.Torrents.find(e => e.ID == tid); | |
| let finalstring = "" | |
| for (let file of torrent.FileList) { | |
| finalstring += `${file.filename}\t${file.size}\n` | |
| } | |
| navigator.clipboard.writeText(finalstring) | |
| console.log(finalstring) | |
| } | |
| function spawnButtons() { | |
| document.querySelectorAll(`ul[id*="tabs_"]`).forEach(e => { | |
| let tid = e.id.split("_")[1] | |
| let child = document.createElement("li") | |
| let btn = document.createElement("a") | |
| btn.innerText = "Copy Filelist" | |
| btn.href = "#" | |
| btn.onclick = () => { copyFilelist(Number(tid)) } | |
| child.appendChild(btn) | |
| e.appendChild(child) | |
| }) | |
| } | |
| let data = await getFromAPI() | |
| spawnButtons() | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment