<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" date="2021.03.24">
    <url><![CDATA[https?://(?:\w+\.)?1905\.com/.*?/(?<id>\d+)\.shtml?]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[duration=([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <exjs><![CDATA[https://cdn.jsdelivr.net/gh/btjson/player@latest/aes.js]]></exjs>
    <jsCode><![CDATA[
        try {
            //https://www.1905.com/vod/play/1278357.shtml
            //https://www.1905.com/vod/play/1289799.shtml
            var vc = this.VODCONFIG || this.VIDEOCONFIG;
            var title = vc ? vc.title : (this.CONFIG ? CONFIG.contentname : document.title);
            var thumbnail = vc ? vc.thumb : (document.body.innerHTML.match(/\"[^\"]+\.jpg/) ? document.body.innerHTML.match(/\"([^\"]+\.jpg)/)[1] : '');
            var duration = vc ? vc.play_duration || vc.duration : (this.CONFIG ? CONFIG.duration : 0);

            var video_url = getol(window.location.href);
            if (!video_url)
                video_url = window.location.href;

            document.body.innerHTML = 'title=\"' + title + '\",thumbnail=' + thumbnail + ',duration=' + duration + ',cr_video_url=' + video_url + '$';

            function getol(url) {
                var result = '';
                var os = (window.external.os != undefined) ? window.external.os : true;
                if (!os)
                    return result;

                var api_url = '';
                var data = '';
                var sites = ['https://jx.000180.top/180', 'https://api.927jx.com/wab', 'https://8090.winzoo.cn/jiexi', 'https://1717.ntryjd.net/0526', 'http://api.drgxj.com/jiexi', 'https://vip.bljiex.com'];
                var args = 'url=' + encodeURIComponent(url) + '&time=' + Date.now();
                for (var i = 0; i <= sites.length - 1; i++) {
                    api_url = sites[i] + '/api.php';
                    data = window.external.getPostResult(api_url, args, 'application/x-www-form-urlencoded; charset=UTF-8', api_url);
                    if (!data || data == 'null')
                        continue;
                    //bljiex
                    if (data.indexOf('(') != -1)
                        data = data.match(/\(([^\)]+)/)[1];
                    var jo = JSON.parse(data);
                    if (!jo.url || !window.external.urlExists(jo.url))
                        continue;

                    //m3u8...可能它没有title
                    if (jo.url.match(/php\?\w+=/) && typeof(window.external.saveData) != 'undefined') {
                        var m3u8 = window.external.getHtmlCode(jo.url);
                        if (m3u8 && m3u8.indexOf('#EXTM3U') != -1) {
                            //若必要，再做一层解析
                            if (m3u8.indexOf('url=') != -1) {
                                var f = function($1, $2) {
                                    return atob($2) + '\n';
                                }
                                m3u8 = m3u8.replace(/http.*?url=([^&]+).*?\s/g, f);
                            }
                            result = window.external.saveData(m3u8);
                            break;
                        }
                    }
                    if (jo.title && jo.title != '视频不存在' && jo.title != '解析系统' && jo.url.indexOf('http') != -1 &&
                        (jo.url.indexOf('m3u8') != -1 || jo.url.indexOf('.mp4') != -1)) {
                        result = jo.url;
                        break;
                    }
                }
                if (!result && typeof(CryptoJS) != 'undefined') {
                    api_url = 'https://dm.voooe.cn/m3u8.m3u8?url=' + url;
                    data = window.external.getHtmlCode(api_url);
                    if (data.indexOf('bt_token') != -1 && data.indexOf('\"url\"') != -1) {
                        var bt_token = data.match(/bt_token\s+=\s+\"([^\"]+)/)[1];
                        var url = data.match(/url\":\"([^\"]+)/)[1];
                        var token_key = CryptoJS.enc.Utf8.parse('dvyYRQlnPRCMdQSe');
                        var token_iv =  CryptoJS.enc.Utf8.parse(bt_token);
                        result = CryptoJS.AES.decrypt(url, token_key, {'iv': token_iv}).toString(CryptoJS.enc.Utf8);
                    }
                }
                if (!result) {
                    data = window.external.getHtmlCode('https://api.126c.cn/?url=' + encodeURIComponent(url), 'https://api.sigujx.com/');
                    if (data.indexOf('sigu_url') != -1) {
                        var su = data.match(/sigu_url\"\s+value=\"([^\"]+)/)[1];
                        args = 'url=' + su;
                        api_url = 'https://zl.126c.cn/zl_api.php';
                        data = window.external.getPostResult(api_url, args, 'application/x-www-form-urlencoded; charset=UTF-8', api_url);
                        if (data) {
                            var jo = JSON.parse(data);
                            if (jo.url)
                                result = jo.url;
                        }
                    }
                }
                if (!result) {
                    api_url = 'https://v.jhys.top/jhjiexi/jianghu.php?v=' + url;
                    data = window.external.getHtmlCode(api_url);
                    if (data.indexOf('\"url\"') != -1)
                        result = data.match(/url\":\s+\"([^\"]+)/)[1];
                }
                if (!result) {
                    api_url = 'https://yi29f.cn/vip01/api.php?url=' + encodeURIComponent(url);
                    data = window.external.getHtmlCode(api_url);
                    if (data && data != 'null') {
                        var jo = JSON.parse(data);
                        if (jo.url)
                            result = jo.url;
                    }
                }
                return result;
            }
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>