Sleazy Fork is available in English.

Japonx 字幕&视频 下载(不要用迅雷下载,支持PotPlayer播放)

下载 japonx 的字幕和视频。

Version vom 12.10.2018. Aktuellste Version

// ==UserScript==
// @name        Japonx 字幕&视频 下载(不要用迅雷下载,支持PotPlayer播放)
// @description 下载 japonx 的字幕和视频。
// @version     3.3.3
// @author      ThisAV
// @homepage    https://greasyfork.org/zh-CN/users/122964
// @namespace   https://greasyfork.org/users/122964
// @feedback    https://greasyfork.org/en/scripts/372676/feedback
// @connect     japronx.com
// @connect     japonx.net
// @connect     japonx.vip
// @include     https://japonx.net/portal/index/detail/id/*
// @include     https://japonx.vip/portal/index/detail/id/*
// @include     https://www.japonx.net/portal/index/detail/id/*
// @include     https://www.japonx.vip/portal/index/detail/id/*
// @run-at      document-idle
// @require     http://cdn.staticfile.org/jquery/2.1.4/jquery.min.js
// @require     https://greasyfork.org/scripts/373130/code/ProtocolCheck.js?version=635816
// @icon        https://www.japonx.vip/favicon.ico
// @grant       GM_addStyle
// @grant       unsafeWindow
// @grant       GM_xmlhttpRequest
// @grant       GM_openInTab
// ==/UserScript==

(function(){
    'use strict';
    //内嵌字幕:
    //VTT字母:103、277
    //MP4:277,632
    //MP4HD: 250
    //M3U8 & MP4: 3573
    var host=location.hostname,
        PageId=location.href.replace(/.+\/id\/(\d+).html/i,'$1'),
        VideoID=$('dt:contains(番號)').next().text(), //番号
        VideoUrl, VideoDownload=false, VideoUrlMP4,
        VideoSubUrl;

    var $btnDiv = $('#d-btn');
    if(1) $btnDiv.append('<a class="d-btn sub" target="_blank" href="https://'+host+'/portal/index/ajax_get_js.html?id='+PageId+'">Ajax</a>');

    var JaPronX={
        CheckUrl : function(url, callback){
            GM_xmlhttpRequest({
                url:url,
                method:'head',
                async:true,
                ontimeout:10000,
                onload:callback,
                onerror:function(e){
                    console.log('error',e);
                }
            });
        }
    }

    $.ajax({
        'url':'/portal/index/ajax_get_js.html',
        'data' : {'id':PageId},
        'responseType':'text',
        'success' : function(s, t, e){
            GM_addStyle("dl.desc {width:400px;} #contents-inline dl a:hover{border:1px solid #00aaff;margin:1px!important;} .play{margin-right:0px!important;} .PotPlayer, .sub{width:130px;}");


            //console.log(t,e, s);

            if(s.search(/\|(mp4)\|/im)>-1) {
                if(s.search(/\d+HD/im)>-1) VideoID+="HD";
                if(s.search(/\d_hd/im)>-1) VideoID=VideoID.toLowerCase().replace('-','')+'_hd';
                VideoUrl="https://player.japronx.com/Stream/"+VideoID+".mp4";
                VideoDownload=true;
            } else if(s.search(/\|(m3u8)\|/im)>-1) {
                if(s.search(/\d+HD/im)>-1) VideoID+="HD";
                if(s.search(/\d_hd/im)>-1) VideoID=VideoID.toLowerCase().replace('-','')+'_hd';
                VideoUrl="https://play.japronx.com/"+VideoID+"/"+VideoID+".m3u8";
                VideoUrlMP4="https://player.japronx.com/Stream/"+VideoID+".mp4";
            }

            JaPronX.CheckUrl(VideoUrl, function(e){
                //console.log('load', e);
                if(VideoDownload) $('.d-btn.download').attr({'href':VideoUrl, 'target':'blank', 'download':VideoID}).css({'color':'black'});
                else {
                    JaPronX.CheckUrl(VideoUrlMP4, function(e){
                        $('.d-btn.download').attr({'href':VideoUrlMP4, 'target':'blank', 'download':VideoID}).css({'color':'black'});
                    });
                }
                $btnDiv.append($('<a class="d-btn PotPlayer">').attr({'href':'potplayer://'+VideoUrl}).css({'color':'black'}).text('Potplayer').click(function(){
                    window.protocolCheck(this.href, function(){
                        if(confirm("协议未注册,现在去注册程序协议?")) GM_openInTab("https://greasyfork.org/zh-CN/scripts/372676/#potplayer");
                    });
                }));
            });
            //$('.d-btn.download').text('暂无法下载').css('width','130px');

            //字幕
            if(s.search(/\|vtt\|/im)===-1) $zmBtn = $('<a class="d-btn sub" style="color:#ccc;" href="javascript:void(0);">无字幕文件</a>');
            else {
                var Arr=s.match(/\|vtt\|(\w+)\|(\w+)\|/im),
                    Arry=s.split('|'),
                    uSubDate=Arr[2],  //上传日期
                    uSubKey=Arr[1],   //文件名
                    $zmBtn;
                console.log(Arr,Arry);
                if(uSubKey.length===32) VideoSubUrl='https://'+host+'/upload/admin/'+uSubDate+'/'+uSubKey+'.vtt';
                else {
                    //如果无法直接提取到文件名,则遍历返回的内容
                    console.log('uSubKey 不是文件名:', uSubKey);
                    $.each(Arry,function(index,val){
                        if(val.length===32) {
                            uSubKey=val;
                            uSubDate=Arry[index+1];
                            return false;
                        }
                    });
                    VideoSubUrl='https://'+host+'/upload/admin/'+uSubDate+'/'+uSubKey+'.vtt';
                }
            }

            if(VideoSubUrl && VideoSubUrl != 'undefined'){
                $zmBtn = $('<a class="d-btn sub" target="_blank">下載字幕</a>').attr({'download':VideoID+'.vtt', 'href':VideoSubUrl});
            };
            $btnDiv.append($zmBtn);
        },
        'error' : function(){

        }
    });

})();