115已有影片标记

在AVMOO、JAVBUS等片库网站中对在自己115网盘中已存在的影片用蓝色标题标记

La data de 01-10-2019. Vezi ultima versiune.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         115已有影片标记
// @author       kyay006
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  在AVMOO、JAVBUS等片库网站中对在自己115网盘中已存在的影片用蓝色标题标记
// @description  理论上只要页面看起来跟AVMOO、JAVBUS像,脚本就支持该网站,只需自行在下方参照格式添加一条match即可
// @match        http*://avmask.com/*
// @match        http*://avmoo.com/*
// @match        http*://www.javbus.com/*
// @domain     115.com
// @require      https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// @grant         GM_xmlhttpRequest
// @grant         GM_notification
// ==/UserScript==

(function() {
    var cookie = "";//★★★使用前请先在双引号中填入你的115 Cookie★★★
    var nodes = $('div.photo-info');

    var url_user_info = "https://webapi.115.com/files/index_info";
    var url_search = "https://webapi.115.com/files/search?cid=0&search_value=";

    if(cookie == ""){
        msg("脚本中的Cookie为空\n请先在脚本中填写Cookie,否则将无法查询数据!");
    }else{
        getCookieState();
    }

    function getCookieState(){
        httpGet(url_user_info,function(xhr){
            var json = $.parseJSON(xhr.responseText);
            if(json.state){
                nodes.each(function(){
                    findVideo($(this));
                })
            }else{
                msg("脚本中的Cookie已过期,请重新填写!");
            }
        })
    }

    function findVideo(node){
        censored(node);
    }

    function censored(node){
        var code = node.find('span date:first').text();
        httpGet(url_search + code, function(xhr){
            var json = $.parseJSON(xhr.responseText);
            if(!$.isEmptyObject(json.data)){
                setCss(node);
            }else{
                code = code.replace("-","");
                httpGet(url_search + code, function(xhr){
                    var json = $.parseJSON(xhr.responseText);
                    if(!$.isEmptyObject(json.data)){
                        setCss(node);
                    }
                })
            }
        })
    }

    function setCss(parentNode){
        var span = parentNode.find("span:first");
        //span.css("font-weight","bold");
        span.css("color","blue");
    }

    function httpGet(url, callback){
        GM_xmlhttpRequest({
            method:"GET",
            url:url,
            headers:{'Cookie':cookie},
            onload:xhr => callback(xhr)
        })
    }

    function msg(content){
        GM_notification(content,"油猴脚本\"115已有影片标记\"");
    }
    // Your code here...
})();