Greasy Fork

Greasy Fork is available in English.

音悦台视频免会员看1080p,增加下载视频功能

音悦台视频免会员看1080p(如果有,否则选目前清晰度最高),视频下载,把原来点击下载却进入注册登录界面的链接直接替换成视频下载链接,直接进入下载,支持1080p(同上),第一次使用会申请跨域请求,请允许该操作。

当前为 2018-10-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         音悦台视频免会员看1080p,增加下载视频功能
// @namespace    https://zhang18.top
// @version      0.2
// @description  音悦台视频免会员看1080p(如果有,否则选目前清晰度最高),视频下载,把原来点击下载却进入注册登录界面的链接直接替换成视频下载链接,直接进入下载,支持1080p(同上),第一次使用会申请跨域请求,请允许该操作。
// @author       ZLOE
// @match        http://v.yinyuetai.com/video/*
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    //获取视频下载链接
    function get_down_url(){
        var text = $('meta[property="og:url"]').attr("content")
        var id = text.split('/')[4]
        var url = 'http://www.yinyuetai.com/api/info/get-video-urls?videoId='+id
        GM_xmlhttpRequest({
            method: "GET",
            url: url,
            dataType: 'JSON',
            onload: function(res) {
                console.log("请求HTML成功!")
                if (res.status == 200) {
                    //jq解析json
                   var find_text =  jQuery.parseJSON(res.response)
                   try
                   {
                       var find = find_text.heVideoUrl
                   }
                    catch(err){
                        find = find_text.hcVideoUrl
                    }
                    //添加进下载链接
                    $('.download').attr('href',find)
                    console.log(find)
                   //替换视频url
                    if (find.length !=0){
                        window.setTimeout(play,1000)
                    }
                    else{
                        console.log("没有视频源")
                    }
                }

            }
        });

    }
     //判断是否有链接,有就替换掉播放源
    function play(){
        var find = $('.download').attr('href')
        $('.video-stream').attr('src',find)
        //验证是否切换成功
        var yes = $('.video-stream').attr('src')
        if (yes == find){
            console.log("替换播放源成功!")
            $('.html5-video-player .vp-resolution-box').remove()

        }else{
            window.setTimeout($('.video-stream').attr('src',find),3000)
            console.log("尝试二次替换")
        }

    }
    //强制html5
    function html5(){
        var text = window.location.href
        var a = text.split('/')
        var id = a[4]
        if (id != 'h5'){
        var url = 'http://v.yinyuetai.com/video/h5/'+id
        window.location.href = url
        }else{
            console.log("跳转成功")
        }
    }
    //主控制程序
   html5()
   get_down_url()

    // Your code here...
})();