Last active
October 11, 2021 14:05
-
-
Save cristovao-trevisan/7371db2d3ee428282367e488cdadfe84 to your computer and use it in GitHub Desktop.
Open torrent links
This file contains 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
// get page links | |
const elements = document.getElementsByTagName('a') | |
const links = [] | |
for(const link of elements) links.push(link) | |
// filter wanted torrents | |
const hrefs = links | |
.filter(l => l.innerText === '720p') | |
.map(l => l.href) | |
const torrents = hrefs | |
.map(href => /magnet.*/.exec(href)) | |
.filter(x => !!x) | |
.map(match => match[0]) | |
.map(unescape) | |
// open torrent links | |
torrents.forEach(torrent => window.open(torrent)) |
This file contains 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
function keroseedSingle(href) { | |
let torrent = /url=(.*)(#|&|^)/.exec(href)[1] | |
torrent = unescape(torrent) | |
torrent = atob(torrent) | |
window.open(torrent) | |
} | |
function keroseed(amount = 1, start = undefined, text = '720p') { | |
const elements = document.getElementsByTagName('a') | |
const links = [] | |
for(const link of elements) links.push(link) | |
// filter wanted torrents | |
const hrefs = links | |
.filter(l => l.innerText === text) | |
.map(l => l.href) | |
const torrents = hrefs | |
.map(href => /url=(.*)(#|&|^)/.exec(href)) | |
.filter(x => !!x) | |
.map(match => match[1]) | |
.map(unescape) | |
.map(atob) | |
// default to last n episodes | |
if (start === undefined) start = torrents.length - amount; | |
// open torrent links | |
torrents | |
.slice(start, start + amount) | |
.forEach(torrent => window.open(torrent)) | |
} |
This file contains 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
const amount = 1 | |
const elements = document.getElementsByClassName('capitulo-manga-links') | |
const rawLinks = [] | |
for(const el of elements) rawLinks.push(el.children[0].href) | |
const toDriveDownload = id => `https://docs.google.com/uc?export=download&id=${id}` | |
const extractLink = link => { | |
if (link.includes('id=')) return toDriveDownload(link.match(/id=(.*)/)[1]) | |
else if (link.includes('file/d')) return toDriveDownload(link.match(/file\/d\/(.*)\//)[1]) | |
return link | |
} | |
const links = rawLinks | |
.map(l => l.match(/&s=(.*)/)[1]) | |
.map(l => atob(l)) | |
.map(extractLink) | |
const toDownload = links.slice(0, amount) | |
toDownload.forEach(link => window.open(link)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment