Sleazy Fork is available in English.

Japonx 字幕&视频 下载(不要用迅雷下载)

下载 japonx 的字幕和视频。

Fra 08.10.2018. Se den seneste versjonen.

// ==UserScript==
// @name         Japonx 字幕&视频 下载(不要用迅雷下载)
// @homepage    https://greasyfork.org/zh-CN/users/122964
// @version      3.2.1
// @description  下载 japonx 的字幕和视频。
// @author       ThisAV
// @connect     *.japonx.net
// @include     https://www.japonx.net/portal/index/detail/id/*
// @run-at      document-idle
// require			http://code.jquery.com/jquery-2.1.4.min.js
// @require			http://cdn.staticfile.org/jquery/2.1.4/jquery.min.js
// @feedback        https://greasyfork.org/en/scripts/372676/feedback
// @icon            https://www.japonx.net/favicon.ico
// @grant       GM_addStyle
// @namespace https://greasyfork.org/users/122964
// ==/UserScript==
(function(){
    'use strict';
    //内嵌字幕:
    //VTT字母:103、277
    //MP4:277
    //MP4HD: 250
    //M3U8 & MP4: 3573
    var host=location.hostname,
        PageId=location.href.replace(/.+\/id\/(\d+).html/i,'$1'),
        VideoID=$('dt:contains(番號)').next().text(), //番号
        VideoUrl,
        VideoSubUrl;

    var $btnDiv = $('#d-btn');
    if(1) $btnDiv.append('<a class="d-btn sub" target="_blank" href="https://www.japonx.net/portal/index/ajax_get_js.html?id='+PageId+'">Ajax</a>');
    $.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;} .sub{width:130px;}");


            console.log(t,e, s);
            //视频
            if(s.search(/\|(mp4|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://player.japronx.com/Stream/"+VideoID+".mp4";
            }
            if(VideoUrl) $('.d-btn.download').attr({'href':VideoUrl, 'target':'blank', 'download':VideoID}).css({'color':'black'});

            //字幕
            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(){

        }
    });

})();