Greasy Fork

Greasy Fork is available in English.

Yinyuetai

免积分,免登录,既可观看、下载高清MV,支持1080p

当前为 2016-03-31 提交的版本,查看 最新版本

// ==UserScript==
// @name           Yinyuetai
// @author         hyk
// @namespace      [email protected]
// @description    免积分,免登录,既可观看、下载高清MV,支持1080p
// @version        1.0.1
// @create         2016-03-28
// @lastmodified   2016-03-31

// @include        http://v.yinyuetai.com/video/*
// @include        http://v.yinyuetai.com/playlist/*
// @copyright      2016+, hyk
// @require       http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js
// @grant          unsafeWindow
// @grant		GM_setClipboard
// @grant		GM_xmlhttpRequest
// @icon		http://www.yinyuetai.com/favicon.ico
// ==/UserScript==
//***************  只供学习用,请勿用作任何商业用途  *********************
//***************  只供学习用,请勿用作任何商业用途  *********************
//***************  只供学习用,请勿用作任何商业用途  *********************
(function () {
    var dhost = location.hostname,
        Lc = location,
        lurl = Lc.href;

    var win = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow;
    var _Q = function (d) {
            return document.querySelector(d)
        },
        _Qa = function (d) {
            return document.querySelectorAll(d)
        };
    var DM = function (m) {

        return lurl.toLowerCase().indexOf(m) > 0;
    };

    function Log(l) { //调试用
        console.log(l);
    }

    //定义各大浏览器识别
    //    var OP = function () {
    //            return window.opera
    //        },
    //        GC = function () {
    //            return window.chrome
    //        },
    //        FF = function () {
    //            return window.sidebar
    //        };
    //    var $OP = function () {
    //        if (OP()) return $ = jQuery;
    //    }; //O下$修复





    function YYT() { //音悦台,免登录、积分、客户端,支持1080p
        //                function Yyt(Vid,index) {//此处修改自Music liker for beauty ByYulei
        //                  
        //                    GM_xmlhttpRequest({
        //                        url: 'http://www.yinyuetai.com/api/info/get-video-urls?videoId=' + Vid,
        //                        method: "get",
        //                        onload: function (y) {
        //                            var r = $.parseJSON(y.responseText);
        //                            if(DM('/playlist/')){
        //                                var oSpan=$("span.mv-quality-icon").eq(index);
        //                                r.hcVideoUrl ? oSpan.find("a.hc").attr('href', r.hcVideoUrl).show() : oSpan.find("a.hc").hide();
        //                                r.hdVideoUrl ? oSpan.find("a.hd").attr('href', r.hdVideoUrl).show() : oSpan.find("a.hd").hide();
        //                                r.heVideoUrl ? oSpan.find("a.he").attr('href', r.heVideoUrl).show() : oSpan.find("a.he").hide();
        //                               
        //                            }else{
        //                                
        //                                r.hcVideoUrl ? $('#p1').attr('href', r.hcVideoUrl).show() : $('#p1').hide();
        //                                r.hdVideoUrl ? $('#p2').attr('href', r.hdVideoUrl).show() : $('#p2').hide();
        //                                r.heVideoUrl ? $('#p3').attr('href', r.heVideoUrl).show() : $('#p3').hide();
        //                            }
        //                           
        //                           
        //                        }
        //                    })
        //                  
        //                }


        function _Yyt(Vid, index) {

            GM_xmlhttpRequest({
                url: 'http://ext.yinyuetai.com/main/get-h-mv-info?json=true&videoId=' + Vid,
                method: "get",
                onload: function (y) {
                    var r = $.parseJSON(y.responseText);
                    var aVideoUrlModels = r.videoInfo.coreVideoInfo.videoUrlModels;

                    //Log(r.videoInfo.coreVideoInfo.videoUrlModels);

                    var aVideoQuality = ["hc", "hd", "he", "sh"];
                    if (DM('/playlist/')) {
                        var oSpan = $("span.mv-quality-icon").eq(index);

                        for (var i = 0; i < aVideoUrlModels.length; i++) {
                            oSpan.find("a." + aVideoQuality[i]).attr('href', aVideoUrlModels[i].videoUrl).show();
                        }
                    } else {
                        for (var i = 0; i < aVideoUrlModels.length; i++) {
                            $("#video-quality-" + aVideoQuality[i]).attr('href', aVideoUrlModels[i].videoUrl).show();
                        }

                    }


                }
            })

        }
        if (DM('/playlist/')) {
            var MVlist = _Qa(".mvbox_list .mv_picBox");
            //Log(MVlist);
            $(".mvInfo_row01_left").after("<span id='ydList'>悦单列表地址</span><ul class='MV_List'></ul><style>span#ydList{cursor:pointer;padding:3px;font-size:16px;marging-left:20px;position:relative;left:20px;top:10px;color:white;background-color:#333}ul.MV_List{background-color:#333;width:300px;position:absolute;z-index:200;border-radius:5px;float:left}ul.MV_List li{display:inline-block;width:290px;list-style:none;float:left;height:40px;padding:5px;border-bottom:1px solid #404040;text-align:left;}ul.MV_List li span.mv-quality-icon{margin-left:22px;display:inline-block;}span.mv-quality-icon .mv-url{display:none;padding-left:10px;padding-right:10px;margin-left:3px;}ul.MV_List li a{font-size:12px;color:white;text-align:left;margin-left:5px;}ul.MV_List span.mv-index{float:left;width:18px;height:18px;background-color:#f52f2f;padding-top:1px;padding-left:2px;color:white;border-radius:50%;display:inline-block}a.sh{background-color:#31d457;}a.he{background-color:#1e65c6;}a.hd{background-color:#27d5bf;}a.hc{background-color:#e57834;}a.sh:hover{background-color:#3cf066}a.he:hover{background-color:#2b7ded}a.hd:hover{background-color:#35fce2}a.hc:hover{background-color:#f88843}p.mv-title{margin-left:25px;height:20px; color:white;font-size:12px;overflow:hidden}</style>");
            $("#ydList").mouseover(function () {
                $(this).css({
                    "backgroundColor": "404040",
                    color: "#27d5bf"
                });
            });
            $("#ydList").mouseout(function () {
                $(this).css({
                    "backgroundColor": "#333",
                    color: "white"
                });
            });

            $("#ydList").click(function (e) {
                if ($("ul.MV_List li").length == 0) {

                    $("ul.MV_List").css({
                        "left": e.clientX + 15,
                        "top": e.clientY
                    });
                    for (var i = 0; i < MVlist.length; i++) {
                        $("ul.MV_List").append("<li><span class='mv-index'>" + (i + 1) + "</span><p  class='mv-title' title='" + MVlist[i].getAttribute('data-title') + "'>" + MVlist[i].getAttribute('data-title') + "</p><span class='mv-quality-icon'><a target='_blank' class='mv-url sh'>sh</a><a target='_blank' class='mv-url he'>he</a><a target='_blank' class='mv-url hd'>hd</a><a target='_blank' class='mv-url hc'>hc</a></span></li>");

                        _Yyt(MVlist[i].getAttribute('data-id'), i);
                    }
                }
                if ($("ul.MV_List").is(":visible")) {
                    $("ul.MV_List").hide();
                } else {
                    $("ul.MV_List").show();
                }

            });

            //Log($("ul.MV_List a.mv_URL"));
        } else {
            var tbk = 'target="_blank"';
            $('div.pl_title.fl').after('<span  id="Ytai" ' + '><span style="background-color:#484848;height:38px;border-radius:5px;padding:5px;padding-bottom:6px;" class="ico download_ico ico20_pl_down"><a id="video-quality-hc" ' + tbk + ' >标清</a><a id="video-quality-hd" ' + tbk + '>高清</a><a id="video-quality-he" ' + tbk + '>超清</a><a id="video-quality-sh" ' + tbk + '>会员</a></span></span><style>#Ytai a{display:none;margin:3px;color:white;}#Ytai a:hover{color:#669900;}#Ytai{position:relative;left:10px;}</style>');

            _Yyt($('.videoinfobox').attr('videoid') || $('.play a').eq(0).attr('href').match(/\d+/)[0]);
        }

    }

    //
    //    if (!window.sidebar) {
    //        window.addEventListener('DOMContentLoaded', Yu, false);
    //    } else {
    //        YYT();
    //    };
    // 
    YYT();

})();