Telecharger tout les lien sur Tirexo
当前为
// ==UserScript==
// @name TirexoFullDL
// @namespace https://greasyfork.org/fr/users/11667-hoax017
// @version 1.8.0
// @description Telecharger tout les lien sur Tirexo
// @author Hoax017
// @match https://www.tirexo.pro/*/*
// @match https://www2.tirexo.work/*/*
// @match https://www2.tirexo.club/*/*
// @match https://www2.tirexo.ai/*/*
// @match https://ww2.tirexo.cc/*/*
// @match https://www3.tirexo.lol/*/*
// @match https://www.journaldupirate.net/go_to/*
// @match https://www6.journaldupirate.net/go_to/*
// @match https://decotoday.net/redirect/*
// @match https://decotoday.net/open_link/*
// @match https://buzzfil.org/open_link/*
// @screen http://prntscr.com/1qu4dun
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (location.hostname.includes("journaldupirate.net") || location.hostname.includes("decotoday.net") || location.hostname.includes("buzzfil.org")) { // descript links
var msg403;
if ((msg403 = document.querySelector('html body div div h1')) && msg403.innerText == "403") {
setTimeout(_ => location.reload(true), 3000)
} else if (document.querySelector('.alert a')) {
var link = document.querySelector('div.alert a')
link.href = link.href.replace(/(\?|&)af=\d+/,'').replace(/(\?|&)aff_id=\d+/,'')
link.textContent = link.href;
window.opener.parent.postMessage({ link : link.href },"*");
window.close();
} else if (document.querySelector(".message") && document.querySelector(".message").textContent.trim() === "Page Expired") {
setTimeout(location.reload, 2000);
} else if(document.querySelector('input[value="Continuer pour voir le lien"]')) {
document.querySelector('input[value="Continuer pour voir le lien"]').click()
};
} else if (location.hostname.includes("tirexo.")) { // get all links
let finalHostDlLinks = [];
window.addEventListener("message", function (message) {
if(!message.origin.includes("journaldupirate.net") && !message.origin.includes("decotoday.net") && !message.origin.includes("buzzfil.org")) return ;
console.log("Getting URL", message.data.link)
finalHostDlLinks.push(message.data.link)
});
const onDownloadAll = (async function() {
let $parent = $(this).parents('.table-responsive');
let dlAll = !$parent.find('input[type="checkbox"]:checked').length
let alreadyDL = [];
if (dlAll) {
$parent.find('select').val(100).change()
await new Promise((end) => setTimeout(end, 2000));
}
finalHostDlLinks = [];
let closedWindow = 0;
let nbNotOpened = 0;
$parent.find("tbody tr").each(async (i, tr) => {
if (!dlAll && !(tr.querySelector('input[type="checkbox"]') || {checked: false}).checked) {
closedWindow++;
return;
}
let a = tr.querySelector('a.download[data-id]')
let linktitle = a.text.trim();
console.log(linktitle)
if (~alreadyDL.indexOf(linktitle)) {
closedWindow++;
return ;
}
alreadyDL.push(linktitle);
let win
await (new Promise(function(resolve, reject){
let superinter = setInterval(function(){
if(i - closedWindow > 19) return;
console.log(a.href)
win = open(a.href);
if (!win) {
console.error("Impossible d'ouvrir la fenetre");
closedWindow++;
nbNotOpened++;
reject();
} else {
resolve()
}
clearInterval(superinter)
}, i * 2000)
}));
let interval = setInterval(function () {
if (win && win.closed) {
closedWindow++;
if (closedWindow === $parent.find("a.download[data-id]").length) {
setTimeout(_ => {
$("#modal_links #modal_title").text(finalHostDlLinks.length)
$("#modal_links #modal_body").val(finalHostDlLinks.join("\n"))
// alert(`${finalHostDlLinks.length} Liens recuperes\n${finalHostDlLinks.join("\n")}`);
$("#modal_links").modal()
new ClipboardJS('.btn');
}, nbNotOpened * 500)
}
clearInterval(interval);
}
}, 500)
})
});
const init = _ => {
if ($("button.Hoax_validated").length) return;
$("tfoot").each(function (){
let button = $(this).find('button.copy_serie')
button.parent().prev().append($(`<button class="btn btn-info Hoax_validated" type="button"><i class="fa fa-files-o"></i> Copier tout les liens</button>`).on('click', onDownloadAll))
});
};
setInterval(init, 1000);
init()
}
})();