Greasy Fork

Free host download

free down it

目前为 2023-11-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         Free host download
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  free down it
// @author       kingweb
// @license MIT
// @match       https://www.dudujb.com/*
// @match       https://www.iycdn.com/*
// @match       http://www.xunniufxp.com/*
// @match       http://www.xueqiupan.com/*
// @match       https://www.567yun.cn/*
// @match       https://www.77file.com/*
// @grant        none
// ==/UserScript==

(function () {

    'use strict';
    var domain = window.location.host;
    let str = document.documentElement.outerHTML;
    let file_url = window.location.href;

    //select the domain

    if (domain == 'www.77file.com') {

        if (file_url.includes("/s/")) {
            var urlParts = file_url.split('/');
            var dynamicParam = urlParts[urlParts.length - 1];
            window.location.href = '/down/' + dynamicParam + '.html';
        }

        if (file_url.includes("/down/")) {
            let scriptContent = document.body.innerHTML;
            var regex = /load_down_addr1\('([^']+)'\)/g;
            var match = regex.exec(scriptContent);
            let file_id = match[1];
            let element = document.getElementById("addr_box");
            element.parentNode.removeChild(element);
            load_down_addr1(file_id);
        }
    }

    if (domain == 'www.567yun.cn') {
        jumpTo(file_url);
        show_down_url_load_down_addr1(file_url);
    }

    if (domain == 'www.xueqiupan.com') {
        jumpTo(file_url);
        show_down_url_load_down_addr1(file_url);
    }

    if (domain == 'www.xunniufxp.com') {
        jumpTo(file_url);
        show_down_url_load_down_addr1(file_url);
    }

    if (domain == 'www.iycdn.com') {
        jumpTo(file_url);

        //判断当前 url 包含 down-2224.html
        if (file_url.indexOf('down-') > -1) {
            let down_box = document.getElementById('down_box');
            down_box.style.display = '';
            let file_id = get_down_url_id(file_url);
            //get download list
            $.ajax({
                type: 'post',
                url: 'ajax.php',
                data: 'action=load_down_addr2&file_id=' + file_id,
                dataType: 'text',
                success: function (msg) {
                    var arr = msg.split('|');
                    if (arr[0] == 'true') {
                        $('#addr_list').html(arr[1]);
                        $('#code_box').hide();
                    } else {
                        $('#addr_list').html(msg);
                    }
                },
                error: function () {
                }
            });
        }
    }

    if (domain == 'www.dudujb.com') {

        jumpTo(file_url);

        //判断当前 url 包含 down-2224.html
        if (file_url.indexOf('down-') > -1) {
            let down_box = document.getElementById('down_box');
            down_box.style.display = '';
            let file_id = get_down_url_id(file_url);
            //get download list
            $.ajax({
                type: 'post',
                url: 'ajax.php',
                data: 'action=load_down_addr2&file_id=' + file_id,
                dataType: 'text',
                success: function (msg) {
                    var arr = msg.split('|');
                    if (arr[0] == 'true') {
                        $('#addr_list').html(arr[1]);
                        $('#code_box').hide();
                    } else {
                        $('#addr_list').html(msg);
                    }
                },
                error: function () {
                }
            });
        }


    }





    //Some common methods

    //junmp to url
    function jumpTo(file_url) {

        if (file_url.indexOf('file-') > -1) {
            let file_id = get_file_url_id(file_url);
            if (file_id) {
                window.location.href = 'down-' + file_id + '.html';
            }
        }
    }

    //get file url id
    function get_file_url_id(url) {
        let matches = url.match(/file-(\d+)/);
        if (matches[1]) {
            return matches[1];
        } else {
            alert('获取文件ID失败');
        }

    }

    //get down url id
    function get_down_url_id(file_url) {
        let matches = file_url.match(/down-(\d+)/);
        if (matches[1]) {
            return matches[1];
        } else {
            alert('获取文件ID失败');
        }
    }

    //don't need ajax show download list
    function show_down_url_load_down_addr1(file_url) {
        if (file_url.indexOf('down-') > -1) {
            let down_box = document.getElementById('down_box');
            down_box.style.display = '';
            $("#codefrm").parent().hide();
            load_down_addr1(get_down_url_id(file_url));
        }
    }

})();