Greasy Fork is available in English.

懒人专用,全网VIP视频免费破解去广告、全网音乐直接下载、百度网盘直接下载、知乎视频下载等多合一版。长期更新,放心使用。

自用组合型多功能脚本,无需关注公众号,集合了优酷、爱奇艺、腾讯、芒果等全网VIP视频免费破解去广告,网易云音乐、QQ音乐、酷狗、酷我、虾米、蜻蜓FM、荔枝FM、喜马拉雅等网站音乐和有声书音频免客户端下载,百度网盘直接下载,知乎视频下载,优惠券查询等几个自己常用的功能。

// ==UserScript==
// @name         懒人专用,全网VIP视频免费破解去广告、全网音乐直接下载、百度网盘直接下载、知乎视频下载等多合一版。长期更新,放心使用。
// @namespace 	 lanhaha
// @version      3.2.8
// @description  自用组合型多功能脚本,无需关注公众号,集合了优酷、爱奇艺、腾讯、芒果等全网VIP视频免费破解去广告,网易云音乐、QQ音乐、酷狗、酷我、虾米、蜻蜓FM、荔枝FM、喜马拉雅等网站音乐和有声书音频免客户端下载,百度网盘直接下载,知乎视频下载,优惠券查询等几个自己常用的功能。
// @author       lanhaha,syhyz1990,Chao,zuihuimai
// @include      *://pan.baidu.com/disk/home*
// @include      *://yun.baidu.com/disk/home*
// @include      *://pan.baidu.com/s*
// @include      *://yun.baidu.com/s*
// @include      *://www.zhihu.com/*
// @include      https://v.vzuu.com/video/*
// @include      https://video.zhihu.com/video/*
// @include      *.youku.com/v*
// @include      *m.youku.com/*
// @include      *.iqiyi.com/v_*
// @include      *.iqiyi.com/w_*
// @include      *.iqiyi.com/a_*
// @include      *.le.com/ptv/vplay/*
// @include      *v.qq.com/x/*
// @include      *v.qq.com/p*
// @include      *v.qq.com/cover*
// @include      *v.qq.com/tv/*
// @include      *.tudou.com/listplay/*
// @include      *.tudou.com/albumplay/*
// @include      *.tudou.com/programs/view/*
// @include      *.tudou.com/v*
// @include      *.mgtv.com/b/*
// @include      *tv.sohu.com/*
// @include      *film.sohu.com/album/*
// @include      *.bilibili.com/video/*
// @include      *.bilibili.com/anime/*
// @include      *.bilibili.com/bangumi/play/*
// @include      *.bilibili.com/s/*
// @include      *.pptv.com/show/*
// @include      *.wasu.cn/Play/show*
// @include      *v.yinyuetai.com/video/*
// @include      *v.yinyuetai.com/playlist/*
// @include      *://item.taobao.com/*
// @include      *://*detail.tmall.com/*
// @include      *://*detail.tmall.hk/*
// @include      *://*.liangxinyao.com/*
// @include      *music.163.com/*
// @include      *://y.qq.com/portal*
// @include      *://i.y.qq.com/*
// @include      *://*.kugou.com/*
// @include      *://*kuwo.cn/*
// @include      *://*.xiami.com/*
// @include      *://music.taihe.com/song*
// @include      *://*.1ting.com/player*
// @include      *://music.migu.cn/v*
// @include      *://*.lizhi.fm/*
// @include      *://*.qingting.fm/*
// @include      *://*.ximalaya.com/*
// @exclude      *://*.eggvod.cn/*
// @connect      d.pcs.baidu.com
// @connect      baidu.com
// @connect      baidupcs.com
// @connect      baiduyun.wiki
// @connect      zhihu.com
// @connect      vzuu.com
// @connect      localhost
// @require      https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
// @require      https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js
// @require      https://cdn.jsdelivr.net/npm/sweetalert2@9
// @license      GPL License
// @grant        GM_download
// @grant        GM_openInTab
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @grant        GM_addStyle
// @grant        unsafeWindow
// @grant        GM_setClipboard
// @grant        GM_getResourceURL
// @grant        GM_getResourceText
// @grant        GM_info
// @grant        GM_registerMenuCommand
// @grant        GM_cookie
// @run-at       document-idle
// ==/UserScript==

//百度网盘
(function() {
var pan_title=new Array()
		pan_title[0]= "https://pan.baidu.com/"
		pan_title[1]= "https://yun.baidu.com/"
        let pan_link = location.href;
		for(var a=0;a<pan_title.length;a++){
			if(pan_link.indexOf(pan_title[a])!= -1){
                pan_link = pan_link.replace('baidu.com','baiduwp.com');
				var pan_html = "<a href="+pan_link+" target='_blank' style='cursor:pointer;z-index:98;display:block;width:30px;height:30px;line-height:30px;position:fixed;left:0;top:300px;text-align:center;'><img src='https://www.eggvod.cn/images/vip.png' style='width:50px' ></a>";
				$("body").append(pan_html);

//百度网盘脚本开始
//
(function () {
    'use strict';

    let pageType = '', selectFile = [], params = {}, mode = '', width = 800, pan = {}, color = '',
      doc = $(document), progress = {}, request = {}, ins = {}, idm = {};
    const scriptInfo = GM_info.script;
    const version = scriptInfo.version;
    const author = scriptInfo.author;
    const customClass = {
        container: 'panlinker-container',
        popup: 'panlinker-popup',
        header: 'panlinker-header',
        title: 'panlinker-title',
        closeButton: 'panlinker-close',
        icon: 'panlinker-icon',
        image: 'panlinker-image',
        content: 'panlinker-content',
        htmlContainer: 'panlinker-html',
        input: 'panlinker-input',
        inputLabel: 'panlinker-inputLabel',
        validationMessage: 'panlinker-validation',
        actions: 'panlinker-actions',
        confirmButton: 'panlinker-confirm',
        denyButton: 'panlinker-deny',
        cancelButton: 'panlinker-cancel',
        loader: 'panlinker-loader',
        footer: 'panlinker-footer'
    };

    let toast = Swal.mixin({
        toast: true,
        position: 'top',
        showConfirmButton: false,
        timer: 3000,
        timerProgressBar: false,
        didOpen: (toast) => {
            toast.addEventListener('mouseenter', Swal.stopTimer);
            toast.addEventListener('mouseleave', Swal.resumeTimer);
        }
    });

    let util = {
        clog(c) {
            console.group('[网盘直链下载助手]');
            console.log(c);
            console.groupEnd();
        },
        getCookie(name) {
            let arr = document.cookie.replace(/\s/g, "").split(';');
            for (let i = 0, l = arr.length; i < l; i++) {
                let tempArr = arr[i].split('=');
                if (tempArr[0] == name) {
                    return decodeURIComponent(tempArr[1]);
                }
            }
            return '';
        },
        getValue(name) {
            return GM_getValue(name);
        },
        setValue(name, value) {
            GM_setValue(name, value);
        },
        getStorage(key) {
            return localStorage.getItem(key);
        },
        setStorage(key, value) {
            return localStorage.setItem(key, value);
        },
        setClipboard(text) {
            GM_setClipboard(text, 'text');
        },
        encode(str) {
            return btoa(unescape(encodeURIComponent(str)));
        },
        decode(str) {
            return decodeURIComponent(escape(atob(str)));
        },
        setBDUSS() {
            try {
                GM_cookie && GM_cookie('list', {name: 'BDUSS'}, (cookies, error) => {
                    if (!error) {
                        this.setStorage("baiduyunPlugin_BDUSS", JSON.stringify({BDUSS: cookies[0].value}));
                    }
                });
            } catch (e) {

            }
        },
        getBDUSS() {
            let baiduyunPlugin_BDUSS = this.getStorage('baiduyunPlugin_BDUSS') ? this.getStorage('baiduyunPlugin_BDUSS') : '{"baiduyunPlugin_BDUSS":""}';
            let BDUSS = JSON.parse(baiduyunPlugin_BDUSS).BDUSS || '';
            return BDUSS;
        },
        getExtension(name) {
            let reg = /(?!\.)\w+$/;
            if (reg.test(name)) {
                let match = name.match(reg);
                return match[0].toUpperCase();
            }
            return '';
        },
        convertToAria(link, filename, ua) {
            let BDUSS = this.getBDUSS();
            filename = filename.replace(' ', '_');
            if (BDUSS) {
                return encodeURIComponent(`aria2c "${link}" --out "${filename}" --header "User-Agent: ${ua}" --header "Cookie: BDUSS=${BDUSS}"`);
            } else {
                return {
                    link: pan.assistant,
                    text: pan.init[5]
                };
            }
        },
        blobDownload(blob, filename) {
            if (blob instanceof Blob) {
                const url = URL.createObjectURL(blob);
                const a = document.createElement('a');
                a.href = url;
                a.download = filename;
                a.click();
                URL.revokeObjectURL(url);
            }
        },
        sleep(time) {
            new Promise((resolve) => {
                setTimeout(resolve, time);
            });
        },
        message: {
            success(text) {
                toast.fire({title: text, icon: 'success'});
            },
            error(text) {
                toast.fire({title: text, icon: 'error'});
            },
            warning(text) {
                toast.fire({title: text, icon: 'warning'});
            },
            info(text) {
                toast.fire({title: text, icon: 'info'});
            },
            question(text) {
                toast.fire({title: text, icon: 'question'});
            }
        },
        post(url, data, headers, type) {
            return new Promise((resolve, reject) => {
                let requestObj = GM_xmlhttpRequest({
                    method: "POST", url, headers, data,
                    responseType: type || 'json',
                    onload: (res) => {
                        type === 'blob' ? resolve(res) : resolve(res.response || res.responseText);
                    },
                    onerror: (err) => {
                        reject(err);
                    },
                });
            });
        },
        get(url, headers, type, extra) {
            return new Promise((resolve, reject) => {
                let requestObj = GM_xmlhttpRequest({
                    method: "GET", url, headers,
                    responseType: type || 'json',
                    onload: (res) => {
                        if (res.status === 204) {
                            requestObj.abort();
                            idm[extra.index] = true;
                        }
                        if (type === 'blob') {
                            res.status === 200 && util.blobDownload(res.response, extra.filename);
                            resolve(res);
                        } else {
                            resolve(res.response || res.responseText);
                        }
                    },
                    onprogress: (res) => {
                        if (extra && extra.filename && extra.index) {
                            res.total > 0 ? progress[extra.index] = (res.loaded * 100 / res.total).toFixed(2) : progress[extra.index] = 0.00;
                        }
                    },
                    onloadstart() {
                        extra && extra.filename && extra.index && (request[extra.index] = requestObj);
                    },
                    onerror: (err) => {
                        reject(err);
                    },
                });
            });
        }
    };

    let main = {
        /**
         * 配置默认值
         */
        initValue() {
            let value = [{
                name: 'setting_rpc_domain',
                value: 'http://localhost'
            }, {
                name: 'setting_rpc_port',
                value: '16800'
            }, {
                name: 'setting_rpc_token',
                value: ''
            }, {
                name: 'setting_rpc_dir',
                value: 'D:'
            }, {
                name: 'setting_theme_color',
                value: '#09AAFF'
            }, {
                name: 'setting_init_code',
                value: ''
            }, {
                name: 'scode',
                value: ''
            }];

            value.forEach((v) => {
                util.getValue(v.name) === undefined && util.setValue(v.name, v.value);
            });
        },

        addStyle() {
            color = util.getValue('setting_theme_color');
            GM_addStyle(`
            .panlinker-popup { font-size: 12px !important; }
            .panlinker-popup a { color: ${color} !important; }
            .panlinker-header { padding: 0;align-items: flex-start; border-bottom: 1px solid #eee; margin: 0 0 10px; padding: 0 0 5px;}
            .panlinker-title { font-size: 16px; line-height: 1;white-space: nowrap; text-overflow: ellipsis;}
            .panlinker-content { padding: 0; font-size: 12px}
            .panlinker-main { max-height: 400px;overflow-y:scroll}
            .panlinker-footer {font-size: 12px;justify-content: flex-start; margin: 10px 0 0; padding: 5px 0 0; color: #f56c6c}
            .panlinker-item { display: flex; align-items: center; line-height: 22px; }
            .panlinker-item-title { flex: 0 0 150px; text-align: left;margin-right: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
            .panlinker-item-link { flex: 1; overflow: hidden;text-align: left; white-space: nowrap; text-overflow: ellipsis; }
            .panlinker-item-tip { display: flex; justify-content: space-between;flex: 1}
            .panlinker-back { width: 70px; background: #ddd; border-radius: 3px;cursor:pointer;margin:1px 0 }
            .panlinker-ext { display: inline-block; width: 44px; background: #999; color: #fff; height: 16px; line-height: 16px; font-size: 12px; border-radius: 3px;}
            .panlinker-retry {padding: 3px 10px; background: #cc3235; color: #fff; border-radius: 3px; cursor: pointer;}
            .panlinker-browserdownload {padding: 3px 10px; background: ${color}; color: #fff; border-radius: 3px; cursor: pointer;}
            .panlinker-item-progress { display:flex;flex: 1;align-items:center}
            .panlinker-progress { display: inline-block;vertical-align: middle;width: 100%; box-sizing: border-box;line-height: 1;position: relative;height:15px; flex: 1}
            .panlinker-progress-outer { height: 15px;border-radius: 100px;background-color: #ebeef5;overflow: hidden;position: relative;vertical-align: middle;}
            .panlinker-progress-inner{ position: absolute;left: 0;top: 0;background-color: #409eff;text-align: right;border-radius: 100px;line-height: 1;white-space: nowrap;transition: width .6s ease;}
            .panlinker-progress-inner-text { display: inline-block;vertical-align: middle;color: #d1d1d1;font-size: 12px;margin: 0 5px;height: 15px}
            .panlinker-progress-tip{ flex:1;text-align:right}
            .panlinker-progress-how{ flex: 0 0 90px; background: #ddd; border-radius: 3px; margin-left: 10px; cursor: pointer; text-align: center;}
            .panlinker-progress-stop{ flex: 0 0 50px; padding: 0 10px; background: #cc3235; color: #fff; border-radius: 3px; cursor: pointer;margin-left:10px;height:20px}
            .panlinker-progress-inner-text:after { display: inline-block;content: "";height: 100%;vertical-align: middle;}
            .panlinker-btn-primary { background: ${color}; border: 0; border-radius: 4px; color: #ffffff; cursor: pointer; font-size: 12px; outline: none; display:flex; align-items: center; justify-content: center; margin: 2px 0; padding: 6px 0;transition: 0.3s opacity; }
            .panlinker-btn-info { background: #606266; }
            .panlinker-btn-primary:hover { opacity: 0.9;transition: 0.3s opacity; }
            .panlinker-btn-danger { background: #cc3235; }
            .element-clicked { opacity: 0.5; }
            .panlinker-extra { margin-top: 10px;display:flex}
            .panlinker-extra button { flex: 1}
            .pointer { cursor:pointer }
            .panlinker-setting-label { display: flex;align-items: center;justify-content: space-between;padding-top: 10px; }
            .panlinker-label { flex: 0 0 100px;text-align:left; }
            .panlinker-input { flex: 1; padding: 8px 10px; border: 1px solid #c2c2c2; border-radius: 5px; font-size: 14px }
            .panlinker-color { flex: 1;display: flex;flex-wrap: wrap; margin-right: -10px;}
            .panlinker-color-box { width: 35px;height: 35px;margin:10px 10px 0 0;; box-sizing: border-box;border:1px solid #fff;cursor:pointer }
            .panlinker-color-box.checked { border:3px dashed #111!important }
            .panlinker-close:focus { outline: 0; box-shadow: none; }
            .tag-danger {color:#cc3235;margin: 0 5px;}
            `);

        },

        addPageListener() {
            function _factory(e) {
                let target = $(e.target);
                let item = target.parents('.panlinker-item');
                let link = item.find('.panlinker-item-link');
                let progress = item.find('.panlinker-item-progress');
                let tip = item.find('.panlinker-item-tip');
                return {
                    item, link, progress, tip, target,
                };
            }

            function _reset(i) {
                ins[i] && clearInterval(ins[i]);
                request[i] && request[i].abort();
                progress[i] = 0;
                idm[i] = false;
            }

            doc.on('click', '#panlinker-button', () => {
                $('#panlinker-button').addClass('button-open');
            });
            doc.on('mouseleave', '#panlinker-button', () => {
                $('#panlinker-button').removeClass('button-open');
            });
            doc.on('click', '.panlinker-button-mode', (e) => {
                mode = e.target.dataset.mode;
                Swal.showLoading();
                this.getPCSLink();
            });
            doc.on('click', '.listener-link-api', async (e) => {
                e.preventDefault();
                let o = _factory(e);
                let $width = o.item.find('.panlinker-progress-inner');
                let $text = o.item.find('.panlinker-progress-inner-text');
                let filename = o.link[0].dataset.filename;
                let index = o.link[0].dataset.index;
                _reset(index);
                util.get(o.link[0].dataset.link, {"User-Agent": pan.ua}, 'blob', {filename, index});
                ins[index] = setInterval(() => {
                    let prog = progress[index] || 0;
                    let isIDM = idm[index] || false;
                    if (isIDM) { //检测到IDM
                        o.tip.hide();
                        o.progress.hide();
                        o.link.text('已成功唤起IDM,请查看IDM下载框!').animate({opacity: '0.5'}, "slow").show();
                        clearInterval(ins[index]);
                        idm[index] = false;
                    } else {
                        o.link.hide();
                        o.tip.hide();
                        o.progress.show();
                        $width.css('width', prog + '%');
                        $text.text(prog + '%');
                        if (prog == 100) {
                            clearInterval(ins[index]);
                            progress[index] = 0;
                            o.item.find('.panlinker-progress-stop').hide();
                            o.item.find('.panlinker-progress-tip').html('下载完成,正在弹出浏览器下载框!');
                        }
                    }
                }, 500);
            });
            doc.on('click', '.listener-retry', async (e) => {
                let o = _factory(e);
                o.tip.hide();
                o.link.show();
            });
            doc.on('click', '.listener-how', async (e) => {
                let o = _factory(e);
                let index = o.link[0].dataset.index;
                if (request[index]) {
                    request[index].abort();
                    clearInterval(ins[index]);
                    o.progress.hide();
                    o.tip.show();
                }

            });
            doc.on('click', '.listener-stop', async (e) => {
                let o = _factory(e);
                let index = o.link[0].dataset.index;
                if (request[index]) {
                    request[index].abort();
                    clearInterval(ins[index]);
                    o.tip.hide();
                    o.progress.hide();
                    o.link.show(0);
                }
            });
            doc.on('click', '.listener-back', async (e) => {
                let o = _factory(e);
                o.tip.hide();
                o.link.show();
            });
            doc.on('click', '.listener-link-aria, .listener-copy-aria', (e) => {
                e.preventDefault();
                if (!e.target.dataset.link) {
                    $(e.target).removeClass('listener-copy-aria').addClass('panlinker-btn-danger').html(`${pan.init[5]}👉<a href="${pan.assistant}" target="_blank">点击此处安装</a>👈`);
                } else {
                    util.setClipboard(decodeURIComponent(e.target.dataset.link));
                    $(e.target).text('复制成功,快去粘贴吧!').animate({opacity: '0.5'}, "slow");
                }
            });
            doc.on('click', '.listener-link-rpc', async (e) => {
                let res = await this.sendLinkToRPC(e.target.dataset.filename, e.target.dataset.link);
                let target = $(e.target).parents('.panlinker-item').find('.listener-link-rpc');
                if (res === 'success') {
                    target.removeClass('panlinker-btn-danger').text('发送成功,快去看看吧!').animate({opacity: '0.5'}, "slow");
                } else if (res === 'assistant') {
                    target.addClass('panlinker-btn-danger').html(`${pan.init[5]}👉<a href="${pan.assistant}" target="_blank">点击此处安装</a>👈`);
                } else {
                    target.addClass('panlinker-btn-danger').text('发送失败,请检查您的RPC配置信息!').animate({opacity: '0.5'}, "slow");
                }
            });
            doc.on('click', '.listener-send-rpc', (e) => {
                $('.listener-link-rpc').click();
                $(e.target).text('发送完成,发送结果见上方按钮!').animate({opacity: '0.5'}, "slow");
            });
            doc.on('click', '.listener-config-rpc', (e) => {
                this.showSetting();
            });
        },

        /**
         * 添加按钮
         */
        addButton() {
            if ($('#panlinker-button').length > 0) return;
            pageType = this._detectPage();
            if (pageType !== 'home' && pageType !== 'share') return;
            let $toolWrap;
            pageType === 'home' ? $toolWrap = $(pan.btn.home) : $toolWrap = $(pan.btn.share);
            let $button = $(`<span class="g-dropdown-button pointer" id="panlinker-button"><a style="color:#fff;background: ${color};border-color:${color}" class="g-button g-button-blue" href="javascript:;"><span class="g-button-right"><em class="icon icon-download"></em><span class="text" style="width: 60px;">下载助手</span></span></a><span class="menu" style="width:auto;z-index:41;border-color:${color}"><a style="color:${color}" class="g-button-menu panlinker-button-mode" data-mode="api" href="javascript:;">API下载</a><a style="color:${color}" class="g-button-menu panlinker-button-mode" data-mode="aria" href="javascript:;" >Aria下载</a><a style="color:${color}" class="g-button-menu panlinker-button-mode" data-mode="rpc" href="javascript:;">RPC下载</a></span></span>`);
            $toolWrap.prepend($button);

            util.setBDUSS();
            this.addPageListener();
        },

        /**
         * 获取链接
         * @returns {Promise<void>}
         */
        async getPCSLink() {
            selectFile = this.getSelctedFile();
            let fid_list = this._getFidList(), url, res;
            if (pageType === 'home') {
                if (selectFile.length === 0) {
                    return util.message.error('提示:请先勾选要下载的文件!');
                }
                fid_list = encodeURIComponent(fid_list);
                url = `${pan.pcs[0]}&fsids=${fid_list}`;
                res = await util.get(url, {"User-Agent": pan.ua});
            }
            if (pageType === 'share') {
                this.initParams();
                if (selectFile.length === 0) {
                    return util.message.error('提示:请先勾选要下载的文件!');
                }

                if (!params.sign) {
                    let url = `${pan.pcs[2]}&surl=${params.surl}&logid=${params.logid}`;
                    let res = await util.get(url);
                    if (res.errno === 0) {
                        params.sign = res.data.sign;
                        params.timestamp = res.data.timestamp;
                        this._setLocals('sign', res.data.sign);
                        this._setLocals('timestamp', res.data.timestamp);
                    } else {
                        let dialog = await Swal.fire({
                            toast: true,
                            icon: 'info',
                            title: `提示:请将文件<span class="tag-danger">[保存到网盘]</span>👉在<span class="tag-danger">[我的网盘]</span>中下载!`,
                            showConfirmButton: true,
                            confirmButtonText: '点击保存',
                            position: 'top',
                        });
                        if (dialog.isConfirmed) {
                            $('.tools-share-save-hb')[0].click();
                        }
                        return;
                    }
                }
                if (!params.bdstoken) {
                    return util.message.error('提示:登录网盘后才能使用此功能哦!');
                }
                let formData = new FormData();
                formData.append('encrypt', params.encrypt);
                formData.append('product', params.product);
                formData.append('uk', params.uk);
                formData.append('primaryid', params.primaryid);
                formData.append('fid_list', fid_list);
                formData.append('logid', params.logid);
                params.shareType == 'secret' ? formData.append('extra', params.extra) : '';
                url = `${pan.pcs[1]}&sign=${params.sign}&timestamp=${params.timestamp}`;
                res = await util.post(url, formData, {"User-Agent": pan.ua});
            }
            if (res.errno === 0) {
                let html = this.generateDom(res.list);
                this.showMainDialog(pan[mode][0], html, pan[mode][1]);
            } else if (res.errno === 112) {
                return util.message.error('提示:页面过期,请刷新重试!');
            } else {
                util.message.error('提示:获取下载链接失败!请刷新网页后重试!');
            }
        },

        /**
         * 生成Dom元素
         * @param list
         * @returns {string}
         */
        generateDom(list) {
            let content = '<div class="panlinker-main">';
            let alinkAllText = '';
            list.forEach((v, i) => {
                if (v.isdir === 1) return;
                let filename = v.server_filename || v.filename;
                let ext = util.getExtension(filename);
                let dlink = v.dlink;
                if (mode === 'api') {
                    content += `<div class="panlinker-item">
                                <div class="panlinker-item-title" title="${filename}">${filename}</div>
                                <a class="panlinker-item-link listener-link-api" href="${dlink}" data-filename="${filename}" data-link="${dlink}" data-index="${i}" >${dlink}</a>
                                <div class="panlinker-item-tip" style="display: none"><span>若没有弹出IDM下载框,找到IDM <b>选项</b> -> <b>文件类型</b> -> <b>第一个框</b> 中添加后缀 <span class="panlinker-ext">${ext}</span>,<a href="https://www.baiduyun.wiki/zh-cn/idm.html" target="_blank">详见此处</a></span> <span class="panlinker-back listener-back">返回</span></div>
                                <div class="panlinker-item-progress" style="display: none">
                                    <div class="panlinker-progress">
                                        <div class="panlinker-progress-outer"></div>
                                        <div class="panlinker-progress-inner" style="width:5%">
                                          <div class="panlinker-progress-inner-text">0%</div>
                                        </div>
                                    </div>
                                    <span class="panlinker-progress-stop listener-stop">取消下载</span>
                                    <span class="panlinker-progress-tip">未发现IDM,使用自带浏览器下载</span>
                                    <span class="panlinker-progress-how listener-how">如何唤起IDM?</span>
                                </div></div>`;
                }
                if (mode === 'aria') {
                    let alink = util.convertToAria(dlink, filename, pan.ua);
                    if (typeof (alink) === 'object') {
                        content += `<div class="panlinker-item">
                                <div class="panlinker-item-title" title="${filename}">${filename}</div>
                                <a class="panlinker-item-link" target="_blank" href="${alink.link}" alt="点击复制aria2c链接" data-filename="${filename}" data-link="${alink.link}">${decodeURIComponent(alink.text)}</a> </div>`;
                    } else {
                        alinkAllText += alink + '\r\n';
                        content += `<div class="panlinker-item">
                                <div class="panlinker-item-title" title="${filename}">${filename}</div>
                                <a class="panlinker-item-link listener-link-aria" href="${alink}" alt="点击复制aria2c链接" data-filename="${filename}" data-link="${alink}">${decodeURIComponent(alink)}</a> </div>`;
                    }
                }
                if (mode === 'rpc') {
                    content += `<div class="panlinker-item">
                                <div class="panlinker-item-title" title="${filename}">${filename}</div>
                                <button class="panlinker-item-link listener-link-rpc panlinker-btn-primary panlinker-btn-info" data-filename="${filename}" data-link="${dlink}"><em class="icon icon-device"></em><span style="margin-left: 5px;">推送到RPC下载器</span></button></div>`;
                }
            });
            content += '</div>';
            if (mode === 'aria')
                content += `<div class="panlinker-extra"><button class="panlinker-btn-primary listener-copy-aria" data-link="${alinkAllText}">复制全部链接</button></div>`;
            if (mode === 'rpc')
                content += '<div class="panlinker-extra"><button class="panlinker-btn-primary  listener-send-rpc">发送全部链接</button><button class="panlinker-btn-primary listener-config-rpc" style="margin-left: 10px;">配置RPC服务</button></div>';
            return content;
        },

        async sendLinkToRPC(filename, link) {
            let rpc = {
                domain: util.getValue('setting_rpc_domain'),
                port: util.getValue('setting_rpc_port'),
                token: util.getValue('setting_rpc_token'),
                dir: util.getValue('setting_rpc_dir'),
            };
            let BDUSS = util.getBDUSS();
            if (!BDUSS) return 'assistant';

            let url = `${rpc.domain}:${rpc.port}/jsonrpc`;
            let json_rpc = {
                id: new Date().getTime(),
                jsonrpc: '2.0',
                method: 'aria2.addUri',
                params: [`token:${rpc.token}`, [link], {
                    dir: rpc.dir,
                    out: filename,
                    header: [`User-Agent: ${pan.ua}`, `Cookie: BDUSS=${BDUSS}`]
                }]
            };
            try {
                let res = await util.post(url, JSON.stringify(json_rpc), {"User-Agent": pan.ua}, '');
                if (res.result) return 'success';
                return 'fail';
            } catch (e) {
                return 'fail';
            }
        },

        /**
         * 获取选中文件列表
         * @returns {*}
         */
        getSelctedFile() {
            return require('system-core:context/context.js').instanceForSystem.list.getSelected();
        },

        getLogid() {
            let ut = require("system-core:context/context.js").instanceForSystem.tools.baseService;
            return ut.base64Encode(util.getCookie("BAIDUID"));
        },

        initParams() {
            params.shareType = 'secret';
            params.sign = this._getLocals('sign');
            params.timestamp = this._getLocals('timestamp');
            params.bdstoken = this._getLocals('bdstoken');
            params.channel = 'chunlei';
            params.clienttype = 0;
            params.web = 1;
            params.app_id = 250528;
            params.encrypt = 0;
            params.product = 'share';
            params.logid = this.getLogid();
            params.primaryid = this._getLocals('shareid');
            params.uk = this._getLocals('share_uk');
            params.shareType === 'secret' && (params.extra = this._getExtra());
            params.surl = this._getSurl();
        },

        _detectPage() {
            let regx = /[\/].+[\/]/g;
            let page = location.pathname.match(regx);
            let path = page[0].replace(/\//g, '');
            if (path === 'disk') return 'home';
            if (path === 's' || path === 'share') return 'share';
            return '';
        },

        _getLocals(val) {
            try {
                return locals.get(val);
            } catch {
                return '';
            }
        },

        _setLocals(name, val) {
            try {
                return locals.set(name, val);
            } catch {
                return '';
            }
        },

        _getExtra() {
            let seKey = decodeURIComponent(util.getCookie('BDCLND'));
            return '{' + '"sekey":"' + seKey + '"' + "}";
        },

        _getSurl() {
            let reg = /(?:s\/|surl=)([a-zA-Z0-9_-]+)/;
            if (reg.test(location.href)) {
                return location.href.match(reg)[1];
            }
            return '';
        },

        _getFidList() {
            let fidlist = [];
            selectFile.forEach(v => {
                if (v.isdir == 1) return;
                fidlist.push(v.fs_id);
            });
            return '[' + fidlist + ']';
        },
        _resetData() {
            progress = {};
            $.each(request, (key) => {
                (request[key]).abort();
            });
            $.each(ins, (key) => {
                clearInterval(ins[key]);
            });
            idm = {};
            ins = {};
            request = {};
        },

        showMainDialog(title, html, footer) {
            Swal.fire({
                title,
                html,
                footer,
                allowOutsideClick: false,
                showCloseButton: true,
                showConfirmButton: false,
                position: 'top',
                width,
                padding: '15px 20px 5px',
                customClass,
            }).then(() => {
                this._resetData();
            });
        },

        async getPanLinker() {
            let start = performance.now();
            let res = await util.post
            (`https://api.baiduyun.wiki/upgrade?ver=${version}&a=${author}`, {}, {}, 'text');
            pan = JSON.parse(util.decode(res));
            await this._initDialog();
            let end = performance.now();
            let time = (end - start).toFixed(2);
            util.clog(`助手加载成功!版本:${version} 耗时:${time}毫秒`);
            Object.freeze && Object.freeze(pan);
        },

        async _initDialog() {
            if (pan.num === util.getValue('setting_init_code') || pan.num === util.getValue('scode')) {
                this.addButton();
            } else {
                let result = await Swal.fire({
                    title: "初次使用请输入暗号",
                    html: $(`<div><input class="swal2-input" id="init" type="text" placeholder="输入暗号:懒人"></div>`)[0],
                    allowOutsideClick: false,
                    showCloseButton: true,
                    confirmButtonText: '确定'
                });
                if (result.isDismissed && result.dismiss === 'close') return;
                if (pan.num === $('#init').val()) {
                    util.setValue('setting_init_code', pan.num);
                    util.message.success("下载助手加载成功");
                    setTimeout(() => {
                        history.go(0);
                    }, 1500);
                } else {
                    util.setValue('setting_init_code', pan.num);
                    util.message.success("下载助手加载成功");
                    setTimeout(() => {
                        history.go(0);
                    }, 1500);
                }
            }
        },

        registerMenuCommand() {
            GM_registerMenuCommand('设置', () => {
                this.showSetting();
            });
        },

        showSetting() {
            let dom = '', btn = '',
              colorList = ['#09AAFF', '#cc3235', '#574ab8', '#518c17', '#ed944b', '#f969a5', '#bca280'];
            dom += `<label class="panlinker-setting-label"><div class="panlinker-label">RPC主机</div><input type="text"  placeholder="主机地址,需带上http(s)://" class="panlinker-input listener-domain" value="${util.getValue('setting_rpc_domain')}"></label>`;
            dom += `<label class="panlinker-setting-label"><div class="panlinker-label">RPC端口</div><input type="text" placeholder="端口号,例如:Motrix为16800" class="panlinker-input listener-port" value="${util.getValue('setting_rpc_port')}"></label>`;
            dom += `<label class="panlinker-setting-label"><div class="panlinker-label">RPC密钥</div><input type="text" placeholder="无密钥无需填写" class="panlinker-input listener-token" value="${util.getValue('setting_rpc_token')}"></label>`;
            dom += `<label class="panlinker-setting-label"><div class="panlinker-label">保存路径</div><input type="text" placeholder="文件下载后保存路径,例如:D:" class="panlinker-input listener-dir" value="${util.getValue('setting_rpc_dir')}"></label>`;

            colorList.forEach((v) => {
                btn += `<div data-color="${v}" style="background: ${v};border: 1px solid ${v}" class="panlinker-color-box listener-color ${v == util.getValue('setting_theme_color') ? 'checked' : ''}"></div>`;
            });
            dom += `<label class="panlinker-setting-label"><div class="panlinker-label">主题颜色</div> <div class="panlinker-color">${btn}<div></label>`;
            dom = '<div>' + dom + '</div>';

            Swal.fire({
                title: '助手配置',
                html: dom,
                icon: 'info',
                showCloseButton: true,
                showConfirmButton: false,
                footer: pan.footer,
            });

            doc.on('click', '.listener-color', async (e) => {
                util.setValue('setting_theme_color', e.target.dataset.color);
                util.message.success('设置成功!');
                history.go(0);
            });
            doc.on('input', '.listener-domain', async (e) => {
                util.setValue('setting_rpc_domain', e.target.value);
            });
            doc.on('input', '.listener-port', async (e) => {
                util.setValue('setting_rpc_port', e.target.value);
            });
            doc.on('input', '.listener-token', async (e) => {
                util.setValue('setting_rpc_token', e.target.value);
            });
            doc.on('input', '.listener-dir', async (e) => {
                util.setValue('setting_rpc_dir', e.target.value);
            });
        },

        init() {
            this.initValue();
            this.addStyle();
            this.getPanLinker();
            this.registerMenuCommand();
        }
    };

    main.init();
})();
//百度网盘脚本结束
			}
		}
})();
//百度网盘结束
//
(function() {
    var couponUrl = window.location.href;
    if(couponUrl.indexOf('taobao') != -1 || couponUrl.indexOf('tmall') != -1){

    $.get('https://www.zuihuimai.net/vrhr/loading.php',function(loading_html){
    if(loading_html){
    var head = document.getElementsByTagName('head')[0],
	cssURL = 'https://www.zuihuimai.net/tm/style.css',
	linkTag = document.createElement('link');
	linkTag.id = 'dynamic-style';
	linkTag.href = cssURL;
	linkTag.setAttribute('rel','stylesheet');
	linkTag.setAttribute('media','all');
	linkTag.setAttribute('type','text/css');
	head.appendChild(linkTag);
	var goods_id = getQueryString('id');
	var zhm_url = 'https://www.zuihuimai.net/vrhr/index.php';
	if(goods_id){

		$('#J_LinkBasket').parent().after(loading_html);
		$('.J_LinkAdd').parent().after(loading_html);
		if(window.location.host.search('taobao.com') != -1){
			$('#zhm_table').addClass('zhm_tab_taobao');
		}else{
			$('#zhm_table').addClass('zhm_tab_tmall');
		}

		$.get(zhm_url,{goods_id:goods_id},function(data){
			$('#zhm_div_s').html(data);
			$('#zhm_div_s').html(data);
			if(window.location.host.search('taobao.com') != -1){
				$('#zhm_table').addClass('zhm_tab_taobao');
			}else{
				$('#zhm_table').addClass('zhm_tab_tmall');
			}
		});
	}
    }
    });
    }

    var id_random = Math.ceil(Math.random()*100000000);
	var play_url = window.location.href;
	var arr = new Array();
	arr = play_url.split('?')
	var get_url = arr[0];

	if(get_url.indexOf('eggvod.cn') == -1){
		var jx_title=new Array()
		jx_title[0]="youku.com"
		jx_title[1]="iqiyi.com"
		jx_title[2]="le.com"
		jx_title[3]="v.qq.com"
		jx_title[4]="tudou.com"
		jx_title[5]="mgtv.com"
		jx_title[6]="sohu.com"
		jx_title[7]="acfun.cn"
		jx_title[8]="bilibili.com"
		jx_title[9]="pptv.com"
		jx_title[10]="baofeng.com"
		jx_title[11]="yinyuetai.com"
		jx_title[12]="wasu.cn"
		var title_result = false;
		for(var n=0;n<jx_title.length;n++){
			if(get_url.indexOf(jx_title[n])!= -1){
                var play_line_json =  [
                    {"name":"纯净1","url":"https://z1.m1907.cn/?jx="},
                    {"name":"纯净2","url":"https://jx.618g.com/?url="},
                    {"name":"B站1","url":"https://vip.parwix.com:4433/player/?url="},
                    {"name":"B站2","url":"https://www.cuan.la/m3u8.php?url="},
                    {"name":"BL","url":"https://vip.bljiex.com/?v="},
                    {"name":"CK","url":"https://www.ckplayer.vip/jiexi/?url="},
                    {"name":"CHok","url":"https://www.gai4.com/?url="},
                    {"name":"大侠","url":"https://api.10dy.net/?url="},
                    {"name":"ELW","url":"https://jx.elwtc.com/vip/?url="},
                    {"name":"爱跟","url":"https://vip.2ktvb.com/player/?url="},
                    {"name":"冰豆","url":"https://api.qianqi.net/vip/?url="},
                    {"name":"百域","url":"https://jx.618g.com/?url="},
                    {"name":"ckmov","url":"https://www.ckmov.vip/api.php?url="},
                    {"name":"大幕","url":"https://jx.52damu.com/dmjx/jiexi.php?url="},
                    {"name":"迪奥","url":"https://123.1dior.cn/?url="},
                    {"name":"福星","url":"https://jx.popo520.cn/jiexi/?url="},
                    {"name":"跟剧","url":"https://www.5igen.com/dmplayer/player/?url="},
                    {"name":"RDHK","url":"https://jx.rdhk.net/?v="},
                    {"name":"H8","url":"https://www.h8jx.com/jiexi.php?url="},
                    {"name":"豪华","url":"https://api.lhh.la/vip/?url="},
                    {"name":"黑云","url":"https://jiexi.380k.com/?url="},
                    {"name":"蝴蝶","url":"https://api.hdworking.top/?url="},
                    {"name":"IK","url":"https://vip.ikjiexi.top/?url="},
                    {"name":"解析la","url":"https://api.jiexi.la/?url="},
                    {"name":"久播","url":"https://jx.jiubojx.com/vip.php?url="},
                    {"name":"九八","url":"https://jx.youyitv.com/?url="},
                    {"name":"老板","url":"https://vip.laobandq.com/jiexi.php?url="},
                    {"name":"乐喵","url":"https://jx.hao-zsj.cn/vip/?url="},
                    {"name":"M3U8","url":"https://jx.m3u8.tv/jiexi/?url="},
                    {"name":"MUTV","url":"https://jiexi.janan.net/jiexi/?url="},
                    {"name":"明日","url":"https://jx.yingxiangbao.cn/vip.php?url="},
                    {"name":"磨菇","url":"https://jx.wzslw.cn/?url="},
                    {"name":"诺诺","url":"https://www.ckmov.com/?url="},
                    {"name":"诺讯","url":"https://www.nxflv.com/?url="},
                    {"name":"OK","url":"https://okjx.cc/?url="},
                    {"name":"PM","url":"https://www.playm3u8.cn/jiexi.php?url="},
                    {"name":"思云","url":"https://jx.ap2p.cn/?url="},
                    {"name":"思古","url":"https://api.sigujx.com/?url="},
                    {"name":"思古2","url":"https://api.bbbbbb.me/jx/?url="},
                    {"name":"思古3","url":"https://jsap.attakids.com/?url="},
                    {"name":"tv920","url":"https://api.tv920.com/vip/?url="},
                    {"name":"维多","url":"https://jx.ivito.cn/?url="},
                    {"name":"我爱","url":"https://vip.52jiexi.top/?url="},
                    {"name":"无名","url":"https://www.administratorw.com/video.php?url="},
                    {"name":"小蒋","url":"https://www.kpezp.cn/jlexi.php?url="},
                    {"name":"小狼","url":"https://jx.yaohuaxuan.com/?url="},
                    {"name":"智能","url":"https://vip.kurumit3.top/?v="},
                    {"name":"星驰","url":"https://vip.cjys.top/?url="},
                    {"name":"星空","url":"http://60jx.com/?url="},
                    {"name":"云端","url":"https://jx.ergan.top/?url="},
                    {"name":"云析","url":"https://jx.yparse.com/index.php?url="},
                    {"name":"17云","url":"https://www.1717yun.com/jx/ty.php?url="},
                    {"name":"33t","url":"https://www.33tn.cn/?url="},
                    {"name":"41","url":"https://jx.f41.cc/?url="},
                    {"name":"66","url":"https://api.3jx.top/vip/?url="},
                    {"name":"116","url":"https://jx.116kan.com/?url="},
                    {"name":"200","url":"https://vip.66parse.club/?url="},
                    {"name":"4080","url":"https://jx.urlkj.com/4080/?url="},
                    {"name":"973","url":"https://jx.973973.xyz/?url="},
                    {"name":"8090","url":"https://www.8090g.cn/?url="}
                ];
                var zhmVipTop = GM_getValue('zhmTop');

				if(zhmVipTop == undefined){
					zhmVipTop = '200px';
				}

				var zhmVipLeft = GM_getValue('zhmLeft');

				if(zhmVipLeft == undefined){
					zhmVipLeft = '40px';
				}
				var play_wrap_html = "<div class='move' style='position:fixed;z-index:99999999999;left:"+zhmVipLeft+";top:"+zhmVipTop+";border:1px solid red'>";
                play_wrap_html += "<div href='javascript:void(0)' target='_blank' style='margin-top:-10px;margin-left:-40px;cursor:pointer;display:block;width:50px;height:75px;position:absolute;left:0;top:0px;text-align:center;overflow:visible;background-image: url(https://www.eggvod.cn/images/vip.png);background-repeat: no-repeat;' title='点击主图标弹出解析,点击右侧列表站内解析' class='playButton' id="+id_random+">";
				play_wrap_html += "<div style='position:absolute;left:50px;top:-4px;overflow: hidden;width:300px;display:none'class='playLineDiv'>"
				play_wrap_html += "<div style='width:320px;height:316px;overflow-y:scroll;overflow-x:hidden'>";
                play_wrap_html += "<table class='playLineTabel' style='width:300px;border-spacing:5px;border-collapse:separate'><tr>";
                for(var playLineIndex=0 ;playLineIndex < play_line_json.length;playLineIndex++){

                    if((/(^[1-9]\d*$)/.test(playLineIndex/3))){

                        play_wrap_html +="<tr>";

                        play_wrap_html += "<td class='playLineTd' id='"+play_line_json[playLineIndex].url+"' style='padding:6px 0px;width:33%;color:#fff;text-align:center;background-color:#f24443;box-shadow:0px 0px 10px #fff;'>"+play_line_json[playLineIndex]['name']+"</td>";

                        continue;

                    }

                    play_wrap_html += "<td class='playLineTd' id='"+play_line_json[playLineIndex].url+"' style='padding:6px 0px;width:33%;color:#fff;text-align:center;background-color:#f24443;box-shadow:0px 0px 10px #fff;'>"+play_line_json[playLineIndex]['name']+"</td>";

                    if((/(^[1-9]\d*$)/.test((playLineIndex+1)/3))){

                        play_wrap_html +="</tr>";

                    }

                }

                play_wrap_html += "</tr></table>";

                play_wrap_html +="</div></div></div></div>";

                setTimeout(function(){

                    $("body").append(play_wrap_html);

                    $(".playButton").on("mouseover", () => {
                        $(".playLineDiv").show();
                    });
                    $(".playButton").on("mouseout", () => {
                        $(".playLineDiv").hide();
                    })
                    $(".playLineTd").hover(function(){
                        $(this).css("color","#260033");
                        $(this).css("background-color","#fcc0c0");
                    },function(){
                        $(this).css("color","#fff");
                        $(this).css("background-color","#f24443");
                    });

                    var host = location.host;
                    var node = "";
                    var player_nodes = [
                        { url:"v.qq.com", node:"#mod_player"},
                        { url:"www.iqiyi.com", node:"#flashbox"},
                        { url:"v.youku.com", node:"#player"},
                        { url:"w.mgtv.com", node:"#mgtv-player-wrap"},
                        { url:"www.mgtv.com", node:"#mgtv-player-wrap"},
                        { url:"tv.sohu.com", node:"#player"},
                        { url:"film.sohu.com", node:"#playerWrap"},
                        { url:"www.le.com", node:"#le_playbox"},
                        { url:"video.tudou.com", node:".td-playbox"},
                        { url:"v.pptv.com", node:"#pptv_playpage_box"},
                        { url:"vip.pptv.com", node:".w-video"},
                        { url:"www.wasu.cn", node:"#flashContent"},
                        { url:"www.acfun.cn", node:"#ACPlayer"},
                        { url:"vip.1905.com", node:"#player"},
                        {url:"play.tudou.com",node:"#player"},
                        {url:"www.bilibili.com/video",node:"#bilibiliPlayer"},
                        {url:"www.bilibili.com/bangumi",node:"#player_module"},

                    ];
                    for(var m in player_nodes) {

                        if(get_url.indexOf(player_nodes[m].url)!= -1){

                            node = player_nodes[m].node;

                        }
                    }
                    var remove = function(selector) {
                        if (!document.querySelectorAll) {
                            return;
                        }
                        var nodes = document.querySelectorAll(selector);
                        if (nodes) {
                            for (var i = 0; i < nodes.length; i++) {
                                if (nodes[i] && nodes[i].parentNode) {
                                    nodes[i].parentNode.removeChild(nodes[i]);
                                }
                            }
                        }
                    };
                    function removeObj(targetSelector, rootSelector = 'body', wait) {
                        const rootElement = document.querySelector(rootSelector);
                        const targetElement = rootElement.querySelector(targetSelector);
                        if (targetElement) {
                            return Promise.resolve(targetElement)
                        }
                        return new Promise((resolve, reject) => {
                            const callback = function(matationList, observer) {
                                const targetElement = rootElement.querySelector(targetSelector);
                                if (targetElement) {
                                    resolve(targetElement);
                                    observer.disconnect()
                                }
                            };
                            const observer = new MutationObserver(callback);
                            observer.observe(rootElement, {
                                subtree: true,
                                childList: true
                            });
                            if (wait !== undefined) {
                                setTimeout(() => {
                                    observer.disconnect()
                                }, wait)
                            }
                        })
                    };
                    async function removeAll(targetSelector, rootSelector, now = false) {
                    if (now) {
                        const parent = rootSelector ? document.querySelector(rootSelector) : document;
                        if (parent) {
                            const target = parent.querySelector(targetSelector);
                            if (target) {
                                target.remove();
                                return true
                            }
                        }
                        return false
                    }
                    const target = await removeObj(targetSelector, rootSelector);
                    target.remove()
                    };

                    if(play_url.indexOf('iqiyi.com/v_') != -1){

						function iqiyiRemove() {

							remove('div#scrollTip,.qy-glide,#qy-glide,[class^="qy-glide"],[id^="qy-glide"],svg[display="none"][aria-hidden="true"],div[class*="player-side-ear"],div[class^="player-mnb"][data-asyn-pb]');
							removeAll('div[style*="visibility"][style*="visible"]:not([class]):not([id]):not([style*="fixed"])', undefined, false);

						};
						setTimeout(iqiyiRemove, 1234);
						$('div[style*="visibility"][style*="visible"]:not([class]):not([id]):not([style*="fixed"])').hide();
						(function() {
							$("body").on('mouseover', 'ul li [href*="/v_"][href*=".html"]:not([href*="=http"]):not([href*="?http"]):not([href*="#http"])', function(e) {
								let objfj = $(this), href = objfj.attr('href') || objfj.data("href");
								objfj.off('click.chrome');

								objfj.on('click.chrome', function() {
									window.location.href = href
								}).attr('data-href', href).css({
									cursor: 'pointer'
								}).removeAttr('href')
							})
						})();
					}

                    if(play_url.indexOf('v.qq.com/x/cover') != -1){

                    (function() {
                        $("body").on('mouseover', '.item a', function(e) {

                            let objfj = $(this), href = objfj.attr('href') || objfj.data("href");
                            objfj.off('click.chrome');

                            objfj.on('click.chrome', function() {
                                window.location.href = href
                            }).attr('data-href', href).css({
                                cursor: 'pointer'
                            }).removeAttr('href')
                        })
                    })();
                    }

                    $(".playLineTd").click(function(){

						var play_html = "<div style='width:100%;height:100%;'><iframe allowtransparency=true frameborder='0' scrolling='no' allowfullscreen=true allowtransparency=true name='jx_play' style='height:100%;width:100%' id='playIframe'></iframe></div>";

						$(node).html(play_html);

						var iframe_src= this.id+play_url;

						$("#playIframe").attr("src",iframe_src);

						$("#"+id_random).attr('flag',0);

                     });
					 let firstTime='',lastTime='';
					 $('.move').mousedown(function(){
                            $(document).bind("selectstart",function(){return false;});
						 	firstTime = new Date().getTime();
                            $(document).mousemove(function(e){
								$('.move').offset({
									//left:e.pageX,
                                    left:40,
									top:e.pageY,
								});
                                if(e.pageX>50 || e.pageX<1 || e.pageY<15){
                                    $(document).off('mousemove');
                                    $(document).off('selectstart');
                                };
							})
							$('.move').mouseup(function(){
								$(document).off('mousemove');
                                $(document).off('selectstart');
								lastTime = new Date().getTime();
								if( (lastTime - firstTime) < 200){
									$("#"+id_random).attr('flag',1);//没有移动
								}else{
									$("#"+id_random).attr('flag',0);//移动了
								}
                                var zhmTop = $(".move").css('top');
								var zhmLeft= $(".move").css('left')

								GM_setValue('zhmTop',zhmTop);
								GM_setValue('zhmLeft',zhmLeft);
							})
					});
                    $("#"+id_random).click(function(){

						var flag = $("#"+id_random).attr('flag');

						if(flag == 0){
							return false;
						}

                        var play_jx_url = window.location.href;
                        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
                            var mobile_html = "<div style='margin:0 auto;padding:10px;'>";
                            mobile_html +="<button type='button' style='position:absolute;top:0;right:30px;font-size:30px;line-height: 1;color: #000;text-shadow: 0 1px 0 #fff;cursor: pointer;border:0;background:0 0;' onclick='location.reload();'>×</button>";
                            mobile_html += "<div><iframe src='https://www.eggvod.cn/mobile.php?zhm_jx="+play_jx_url +"' allowtransparency=true frameborder='0' scrolling='no' allowfullscreen=true allowtransparency=true name='jx_play'style='height:600px;width:100%'></iframe></div>"
                            mobile_html += "</div>";
                            $("body").html(mobile_html);
                        } else {
                            $.get('https://www.eggvod.cn/jxcode.php',{in:81516699,code:3},function(data){
                                location.href='https://www.eggvod.cn/jxjx.php?lrspm='+data+'&zhm_jx='+play_jx_url;
                            });
                        }
                    });


                }, 3000);

            }
        }

        //music start

        if($.cookie('zhmOnload') == 1){

            $.removeCookie('zhmOnload');

            return false;
        }

        var zhmVipTopMusic = GM_getValue('zhmTopMusic');

        if(zhmVipTopMusic == undefined){
            zhmVipTopMusic = '200px';
        }

        var zhmVipLeftMusic = GM_getValue('zhmLeftMusic');

        if(zhmVipLeft == undefined){
            zhmVipLeftMusic = '0px';
        }

        var music_id = Math.ceil(Math.random()*100000000);
		var music_title=new Array()
		music_title[0]="163.com"
		music_title[1]= "y.qq.com"
		music_title[2]= "kugou.com"
		music_title[3]= "kuwo.cn"
		music_title[4]= "xiami.com"
		music_title[5]= "taihe.com"
		music_title[6]= "1ting.com"
		music_title[7]= "migu.cn"
		music_title[8]= "qingting.fm"
		music_title[9]= "lizhi.fm"
		music_title[10]= "ximalaya.com"
		for(var nn=0;nn <music_title.length;nn++){

			if(get_url.indexOf(music_title[nn])!= -1){


                var music_html = "<div href='javascript:toGet()' id="+music_id+" style='cursor:pointer;z-index:99999999999;display:block;width:50px;height:75px;line-height:30px;position:fixed;left:"+zhmVipLeftMusic+";top:"+zhmVipTopMusic+";text-align:center;background-image: url(https://www.eggvod.cn/images/vip.png);background-repeat:no-repeat;' class='moveMusic'></div>";

                $("body").append(music_html)


			}

		}

        if(get_url.indexOf('163.com')!= -1){
            $.cookie('zhmOnload',1, { expires: 7 });
        }
		var moveMusic = document.getElementsByClassName("moveMusic")[0];

		let firstTime='',lastTime='';

		moveMusic.onmousedown = function (e) {
             document.body.style.userSelect = 'none';
			firstTime = new Date().getTime();
			var e_down = e || window.event;
			var x = e_down.clientX - e_down.target.offsetLeft;
			var y = e_down.clientY - e_down.target.offsetTop;

			document.onmousemove = function(e){
				var e_move = e || window.event;
				let left_ = e_move.clientX - x;
				let top_ = e_move.clientY - y;

				if(left_ < 0){
					left_ = 0;
                    mouseUpFunc()
				}else if(left_ > document.documentElement.clientWidth - e_down.target.offsetWidth){
					left_ = document.documentElement.clientWidth - e_down.target.offsetWidth
				}
				if(top_ < 0){
					top_ = 0
                    mouseUpFunc()
				}else if(top_ > document.documentElement.clientHeight - e_down.target.offsetHeight){
					top_ = document.documentElement.clientHeight - e_down.target.offsetHeight
				}
                if (
                    e_move.clientX > 50 ||
                    e_move.clientX < 0 ||
              e_move.clientY > document.documentElement.clientHeight ||
              e_move.clientY < 0
            ) {
                    mouseUpFunc()
            }
				//moveMusic.style.left = left_+'px';
                moveMusic.style.left = '0px';
				moveMusic.style.top = top_+'px';

			}
			// 释放鼠标
			moveMusic.onmouseup = function(){
				mouseUpFunc();
				lastTime = new Date().getTime();
				if( (lastTime - firstTime) < 200){
					$("#"+music_id).attr('flag',1);//没有移动
				}else{
					$("#"+music_id).attr('flag',0);//移动了
				}
                var zhmTopMusic = $(".moveMusic").css('top');
                var zhmLeftMusic = $(".moveMusic").css('left')

                GM_setValue('zhmTopMusic',zhmTopMusic);
                GM_setValue('zhmLeftMusic',zhmLeftMusic);
			}
            function mouseUpFunc() {
                document.body.style.userSelect = 'auto';
                document.onmousemove = null;
            }
		}

		$("#"+music_id).click(function(){

			var flag = $("#"+music_id).attr('flag');

			if(flag == 0){
				return false;
			}

            var hostUrl = window.location.href;

            if(hostUrl.match(/music\.163\./)){

                if(hostUrl.match(/^https?:\/\/music\.163\.com\/#\/(?:song|dj)\?id/)) {

                    window.open('http://music.jpnet.cc/newmusic/?url='+encodeURIComponent(hostUrl.replace('/#','')));

                }else if(hostUrl.match(/^https?:\/\/y\.music\.163\.com\/m\/(?:song|dj)\?id/)) {

                     window.open('http://music.jpnet.cc/newmusic/?url='+encodeURIComponent('https://music.163.com/song?id='+getQueryString('id')));

                }else{
                  return false;
                }
            }else if(hostUrl.match(/y\.qq\.com/)){

                try {
                    document.querySelector("audio").pause();
                } catch (e) {}

                var qqSong = $('#sim_song_info').children("a").attr("href").match(/song\/(\S*).html/);
                window.open('http://music.jpnet.cc/newmusic/?id='+qqSong[1]+'&type=qq&playUrl='+encodeURIComponent(document.querySelector("audio").src));

            }else if(hostUrl.match(/kugou\.com/)){
                try {
                    document.querySelector("audio").pause();
                } catch (e) {}
                var kgSong = hostUrl.match(/hash=(\S*)&album/);
                window.open('http://music.jpnet.cc/newmusic/?id='+kgSong[1]+'&type=kugou&playUrl='+encodeURIComponent(document.querySelector("audio").src));

            }else if(hostUrl.match(/kuwo\.cn/)){

                try {
                    document.querySelector("audio").pause();
                } catch (e) {}
                var kwSong = hostUrl.match(/play_detail\/(\S*)/);
                console.log(kwSong);
                window.open('http://music.jpnet.cc/newmusic/?id='+kwSong[1]+'&type=kuwo&playUrl='+encodeURIComponent(document.querySelector("audio").src));

            }else if(hostUrl.match(/www\.xiami\.com/)){
                try {
                    document.querySelector("audio").pause();
                } catch (e) {}
                var xmSong = hostUrl.match(/song\/(\S*)/);
                console.log(xmSong);
                window.open('http://music.jpnet.cc/newmusic/?id='+xmSong[1]+'&type=xiami&playUrl='+encodeURIComponent(document.querySelector("audio").src));

            }else if(hostUrl.match(/www\.ximalaya\.com/)){
                var xmlyUrlArr = hostUrl.split("/");

                for(var xuaIndex =0;xuaIndex<xmlyUrlArr.length;xuaIndex++){

                    if(xuaIndex==xmlyUrlArr.length-1){

                        window.open('http://music.jpnet.cc/newmusic/?id='+xmlyUrlArr[xuaIndex]+'&type=xmly&playUrl='+encodeURIComponent(hostUrl));

                    }

                }
            }else if(hostUrl.match(/music\.taihe\.com/)){
                return false;
            }else{
                 return false;

            }

		});

	}


	//获取url参数;
	function getQueryString(e) {
		var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)");
		var a = window.location.search.substr(1).match(t);
		if (a != null) return a[2];
		return "";
	}
})();
//知乎视频下载
(async () => {
    if (window.location.host == 'www.zhihu.com') return;

    const playlistBaseUrl = 'https://lens.zhihu.com/api/videos/';
    //const videoBaseUrl = 'https://video.zhihu.com/video/';
    const videoId = window.location.pathname.split('/').pop(); // 视频id
    const menuStyle = 'transform:none !important; left:auto !important; right:-0.5em !important;';
    const playerId = 'player';
    const coverSelector = '#' + playerId + ' > div:first-child > div:first-child > div:nth-of-type(2)';
    const controlBarSelector = '#' + playerId + ' > div:first-child > div:first-child > div:last-child > div:last-child > div:first-child';
    const svgDownload = '<path d="M9.5,4 H14.5 V10 H17.8 L12,15.8 L6.2,10 H9.5 Z M6.2,18 H17.8 V20 H6.2 Z"></path>';
    let player = document.getElementById(playerId);
    let resolutionMap = {'标清': 'sd', '高清': 'ld', '超清': 'hd'};
    let videos = []; // 存储各分辨率的视频信息
    let downloading = false;

    function getBrowerInfo() {
        let browser = (function (window) {
            let document = window.document;
            let navigator = window.navigator;
            let agent = navigator.userAgent.toLowerCase();
            // IE8+支持.返回浏览器渲染当前文档所用的模式
            // IE6,IE7:undefined.IE8:8(兼容模式返回7).IE9:9(兼容模式返回7||8)
            // IE10:10(兼容模式7||8||9)
            let IEMode = document.documentMode;
            let chrome = window.chrome || false;
            let system = {
                // user-agent
                agent: agent,
                // 是否为IE
                isIE: /trident/.test(agent),
                // Gecko内核
                isGecko: agent.indexOf('gecko') > 0 && agent.indexOf('like gecko') < 0,
                // webkit内核
                isWebkit: agent.indexOf('webkit') > 0,
                // 是否为标准模式
                isStrict: document.compatMode === 'CSS1Compat',
                // 是否支持subtitle
                supportSubTitle: function () {
                    return 'track' in document.createElement('track');
                },
                // 是否支持scoped
                supportScope: function () {
                    return 'scoped' in document.createElement('style');
                },

                // 获取IE的版本号
                ieVersion: function () {
                    let rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
                    let match = rMsie.exec(agent);
                    try {
                        return match[2];
                    } catch (e) {
                        return IEMode;
                    }
                },
                // Opera版本号
                operaVersion: function () {
                    try {
                        if (window.opera) {
                            return agent.match(/opera.([\d.]+)/)[1];
                        }
                        else if (agent.indexOf('opr') > 0) {
                            return agent.match(/opr\/([\d.]+)/)[1];
                        }
                    } catch (e) {
                        return 0;
                    }
                }
            };

            try {
                // 浏览器类型(IE、Opera、Chrome、Safari、Firefox)
                system.type = system.isIE ? 'IE' :
                    window.opera || (agent.indexOf('opr') > 0) ? 'Opera' :
                        (agent.indexOf('chrome') > 0) ? 'Chrome' :
                            //safari也提供了专门的判定方式
                            window.openDatabase ? 'Safari' :
                                (agent.indexOf('firefox') > 0) ? 'Firefox' :
                                    'unknow';

                // 版本号
                system.version = (system.type === 'IE') ? system.ieVersion() :
                    (system.type === 'Firefox') ? agent.match(/firefox\/([\d.]+)/)[1] :
                        (system.type === 'Chrome') ? agent.match(/chrome\/([\d.]+)/)[1] :
                            (system.type === 'Opera') ? system.operaVersion() :
                                (system.type === 'Safari') ? agent.match(/version\/([\d.]+)/)[1] :
                                    '0';

                // 浏览器外壳
                system.shell = function () {
                    if (agent.indexOf('edge') > 0) {
                        system.version = agent.match(/edge\/([\d.]+)/)[1] || system.version;
                        return 'Edge';
                    }
                    // 遨游浏览器
                    if (agent.indexOf('maxthon') > 0) {
                        system.version = agent.match(/maxthon\/([\d.]+)/)[1] || system.version;
                        return 'Maxthon';
                    }
                    // QQ浏览器
                    if (agent.indexOf('qqbrowser') > 0) {
                        system.version = agent.match(/qqbrowser\/([\d.]+)/)[1] || system.version;
                        return 'QQBrowser';
                    }
                    // 搜狗浏览器
                    if (agent.indexOf('se 2.x') > 0) {
                        return '搜狗浏览器';
                    }

                    // Chrome:也可以使用window.chrome && window.chrome.webstore判断
                    if (chrome && system.type !== 'Opera') {
                        let external = window.external;
                        let clientInfo = window.clientInformation;
                        // 客户端语言:zh-cn,zh.360下面会返回undefined
                        let clientLanguage = clientInfo.languages;

                        // 猎豹浏览器:或者agent.indexOf("lbbrowser")>0
                        if (external && 'LiebaoGetVersion' in external) {
                            return 'LBBrowser';
                        }
                        // 百度浏览器
                        if (agent.indexOf('bidubrowser') > 0) {
                            system.version = agent.match(/bidubrowser\/([\d.]+)/)[1] ||
                                agent.match(/chrome\/([\d.]+)/)[1];
                            return 'BaiDuBrowser';
                        }
                        // 360极速浏览器和360安全浏览器
                        if (system.supportSubTitle() && typeof clientLanguage === 'undefined') {
                            let storeKeyLen = Object.keys(chrome.webstore).length;
                            let v8Locale = 'v8Locale' in window;
                            return storeKeyLen > 1 ? '360极速浏览器' : '360安全浏览器';
                        }
                        return 'Chrome';
                    }
                    return system.type;
                };

                // 浏览器名称(如果是壳浏览器,则返回壳名称)
                system.name = system.shell();
                // 对版本号进行过滤过处理
                // System.version = System.versionFilter(System.version);

            } catch (e) {
                // console.log(e.message);
            }

            return system;

        })(window);

        if (browser.name == undefined || browser.name == '') {
            browser.name = 'Unknown';
            browser.version = 'Unknown';
        }
        else if (browser.version == undefined) {
            browser.version = 'Unknown';
        }
        return browser;
    }

    function fetchRetry(url, options = {}, times = 1, delay = 1000, checkStatus = true) {
        return new Promise((resolve, reject) => {
            // fetch 成功处理函数
            function success(res) {
                if (checkStatus && !res.ok) {
                    failure(res);
                }
                else {
                    resolve(res);
                }
            }

            // 单次失败处理函数
            function failure(error) {
                times--;

                if (times) {
                    setTimeout(fetchUrl, delay);
                }
                else {
                    reject(error);
                }
            }

            // 总体失败处理函数
            function finalHandler(error) {
                throw error;
            }

            function fetchUrl() {
                return fetch(url, options)
                    .then(success)
                    .catch(failure)
                    .catch(finalHandler);
            }

            fetchUrl();
        });
    }

    // 下载指定url的资源
    async function downloadUrl(url, name = (new Date()).valueOf() + '.mp4') {
        let browser = getBrowerInfo();

        // Greasemonkey 需要把 url 转为 blobUrl
        if (GM_info.scriptHandler == 'Greasemonkey') {
            let res = await fetchRetry(url);
            let blob = await res.blob();
            url = URL.createObjectURL(blob);
        }

        // Chrome 可以使用 Tampermonkey 的 GM_download 函数绕过 CSP(Content Security Policy) 的限制
        if (window.GM_download) {
            GM_download({url, name});
        }
        else {
            // firefox 需要禁用 CSP, about:config -> security.csp.enable => false
            let a = document.createElement('a');
            a.href = url;
            a.download = name;
            // a.target = '_blank';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);

            setTimeout(function () {
                URL.revokeObjectURL(url);
            }, 100);
        }
    }

    function humanSize(size) {
        let n = Math.log(size) / Math.log(1024) | 0;
        return (size / Math.pow(1024, n)).toFixed(0) + ' ' + (n ? 'KMGTPEZY'[--n] + 'B' : 'Bytes');
    }

    if (!player) return;

    // 获取视频信息
    const res = await fetchRetry(playlistBaseUrl + videoId, {
        headers: {
            'referer': 'refererBaseUrl + videoId',
            'authorization': 'oauth c3cef7c66a1843f8b3a9e6a1e3160e20' // in zplayer.min.js of zhihu
        }
    }, 3);
    const videoInfo = await res.json();

    // 获取不同分辨率视频的信息
    for (let [key, video] of Object.entries(videoInfo.playlist)) {
        video.name = key;

        if (!videos.find(v => v.width == video.width)) {
            videos.push(video);
        }
    }

    // 按分辨率大小排序
    videos = videos.sort(function (v1, v2) {
        return v1.width == v2.width ? 0 : (v1.width > v2.width ? 1 : -1);
    }).reverse();

    document.addEventListener('DOMNodeInserted', (evt) => {
        let domControlBar = evt.relatedNode.querySelector(':scope > div:last-child > div:first-child');
        if (!domControlBar || domControlBar.querySelector('.download')) return;

        let domFullScreenBtn = domControlBar.querySelector(':scope > div:nth-last-of-type(1)');
        let domResolutionBtn = domControlBar.querySelector(':scope > div:nth-last-of-type(3)');
        let domDownloadBtn, defaultResolution, buttons;
        if (!domFullScreenBtn || !domFullScreenBtn.querySelector('button')) return;

        // 克隆分辨率菜单或全屏按钮为下载按钮
        domDownloadBtn = (domResolutionBtn && (domResolutionBtn.className == domFullScreenBtn.className))
            ? domResolutionBtn.cloneNode(true)
            : domFullScreenBtn.cloneNode(true);

        defaultResolution = domDownloadBtn.querySelector('button').innerText;

        // 生成下载按钮图标
        domDownloadBtn.querySelector('button:first-child').outerHTML = domFullScreenBtn.cloneNode(true).querySelector('button').outerHTML;
        domDownloadBtn.querySelector('svg').innerHTML = svgDownload;
        domDownloadBtn.className = domDownloadBtn.className + ' download';

        buttons = domDownloadBtn.querySelectorAll('button');

        // button 元素添加对应的下载地址
        buttons.forEach(dom => {
            let video = videos.find(v => v.name == resolutionMap[dom.innerText || defaultResolution]);
            video = video || videos[0];
            dom.dataset.video = video.play_url;
            if (dom.innerText) {
                (dom.innerText = `${dom.innerText} (${humanSize(video.size)})`);
            }
            else if (buttons.length == 1) {
                dom.nextSibling.querySelector('div').innerText = humanSize(video.size);
            }
        });

        // 鼠标事件 - 显示菜单
        domDownloadBtn.addEventListener('pointerenter', () => {
            let domMenu = domDownloadBtn.querySelector('div:nth-of-type(1)');
            if (domMenu) {
                domMenu.style.cssText = menuStyle + 'opacity:1 !important; visibility:visible !important';
            }
        });

        // 鼠标事件 - 隐藏菜单
        domDownloadBtn.addEventListener('pointerleave', () => {
            let domMenu = domDownloadBtn.querySelector('div:nth-of-type(1)');
            if (domMenu) {
                domMenu.style.cssText = menuStyle;
            }
        });

        // 鼠标事件 - 选择菜单项
        domDownloadBtn.addEventListener('pointerup', event => {
            if (downloading) {
                alert('当前正在执行下载任务,请等待任务完成。');
                return;
            }

            let e = event.srcElement || event.target;

            while (e.tagName != 'BUTTON') {
                e = e.parentNode;
            }

            downloadUrl(e.dataset.video);
        });

        // 显示下载按钮
        domControlBar.appendChild(domDownloadBtn);

    });
})();