TirexoFullDL

Telecharger tout les lien sur Tirexo

当前为 2020-11-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         TirexoFullDL
// @namespace    https://greasyfork.org/fr/users/11667-hoax017
// @version      1.0.0
// @description  Telecharger tout les lien sur Tirexo
// @author       Hoax017
// @match        https://www.tirexo.pro/*/*
// @match        https://ww2.tirexo.cc/*/*
// @match        https://www.journaldupirate.net/go_to/*
// @screen       http://prntscr.com/vkuqsv
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if (location.hostname.includes("journaldupirate.net")) { // descript links
        if (document.querySelector('.alert a')) {
            window.opener.parent.postMessage({ link : document.querySelector('.alert a').href.replace(/(\?|&)af=\d+/,'').replace(/(\?|&)aff_id=\d+/,'')},"*");
            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()
            }

            if (document.querySelector('div.alert a')) {
                var link = document.querySelector('div.alert a')
                link.href = link.href.replace(/(\?|&)af=\d+/,'').replace(/(\?|&)aff_id=\d+/,'')
            }
        };
    } else if (location.hostname.includes("tirexo.")) { // get all links
        let finalHostDlLinks = [];
        window.addEventListener("message", function (message) {
            if(!message.origin.includes("journaldupirate.net")) return ;
            finalHostDlLinks.push(message.data.link)
        });
        const onDownloadAll = (async function() {
            let alreadyDL = [];
            let $parent = $(this).parents('.table-responsive');
            $parent.find('select').val(100).change()
            finalHostDlLinks = [];
            let closedWindow = 0;
            $parent.find("a.download").each((i, a) => {
                console.log(a)
                let linktitle = a.text.trim();
                if (~alreadyDL.indexOf(linktitle)) {
                    closedWindow++;
                    return ;
                }
                alreadyDL.push(linktitle);
                let win = open(a.href);
                console.log(a.href)
                let interval = setInterval(function () {
                    if (win.closed) {
                        closedWindow++;
                        if (closedWindow === $parent.find("a.download").length) {
                            alert(finalHostDlLinks.join("\n"));
                        }
                        clearInterval(interval);
                    }
                }, 500)
                })
        });

        $("tfoot").each(function (){
            let button = $(this).find('button.copy_serie')
            button.parent().next().append($(`<button class="btn btn-info copy_serie" data-id="checkbox_uptoboxcom" type="button"><i class="fa fa-files-o"></i> Copier tout les liens</button>`).on('click', onDownloadAll))

        });
    }
})();