<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" referer="true" date="2021.03.21">
    <url><![CDATA[https?://(?:www\.)?51zxw\.net/show\.aspx\?cid=\d+&id=(?<id>\d+)]]></url>
    <title><![CDATA[(?is)<span[^>]+>([^<]+)</span>\s+</div>]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[]]></duration>
    <mediaUrl><![CDATA[<video[^>]+>\s+<source[^>]+src="([^"]+)"]]></mediaUrl>
    <delegate><![CDATA[about:blank]]></delegate>
    <jsCode><![CDATA[
        try {
            //https://www.51zxw.net/Show.aspx?cid=729&id=78077->https://m.51zxw.net/MobileWeb/CourseDetails?cid=729&vid=78077
            var url = window.external.url;
            var m = url.match(/cid=(\d+)&id=(\d+)/);
            var cid = m[1];
            var vid = m[2];
            var api_url = 'https://m.51zxw.net/MobileWeb/CourseDetails?cid=' + cid + '&vid=' + vid;
            headers = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25';
            var html = window.external.getHtmlCodeEx(api_url, headers);
            var thumbnail = 'https://www.51zxw.net/m/img/kcbm/' + cid + '.jpg';
            document.body.innerHTML = 'thumbnail=' + thumbnail + ',' + html;

 
            //下载过程解密不了，此支，留做备忘
            /*var html = window.external.getHtmlCode(url);
            var api_url = 'https://www.51zxw.net' + html.match(/website:([^']+)/)[1];
            var data = window.external.getHtmlCode(api_url, url);
            var jo = JSON.parse(data);
            api_url = jo.video[0][0];
            var e = window.external.getHtmlCode(api_url, url);
            e = e.substr(64).substr(-60).substr(0, 30) + e.substr(64).substring(0, e.substr(64).length - 60) + e.substr(64).substr(-30);
            data = decode(e);
            if (data.indexOf('#EXTM3U') != -1) {
                data = data.substr(0, data.indexOf('ENDLIST') + 7);
                data = data.replace('shipmingko', 'https://www.51zxw.net/shipmingko');
                video_url = window.external.saveData(data);
                document.body.innerHTML = '<video src=\"' + video_url + '\" />';
            }

            //...
            function decode(e) {
                var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
                var t = '';
                var n, r, i;
                var s, o, u, a;
                var f = 0;
                e = e.replace(/[^A-Za-z0-9+/=]/g, '');
                while (f < e.length) {
                    s = _keyStr.indexOf(e.charAt(f++));
                    o = _keyStr.indexOf(e.charAt(f++));
                    u = _keyStr.indexOf(e.charAt(f++));
                    a = _keyStr.indexOf(e.charAt(f++));
                    n = s << 2 | o >> 4;
                    r = (o & 15) << 4 | u >> 2;
                    i = (u & 3) << 6 | a;
                    t = t + String.fromCharCode(n);
                    if (u != 64) {
                        t = t + String.fromCharCode(r)
                    }
                    if (a != 64) {
                        t = t + String.fromCharCode(i)
                    }
                }
                t = _utf8_decode(t);
                return t
            }

            function _utf8_decode(e) {
                var t = '';
                var n = 0;
                var r = c1 = c2 = 0;
                while (n < e.length) {
                    r = e.charCodeAt(n);
                    if (r < 128) {
                        t += String.fromCharCode(r);
                        n++
                    } else if (r > 191 && r < 224) {
                        c2 = e.charCodeAt(n + 1);
                        t += String.fromCharCode((r & 31) << 6 | c2 & 63);
                        n += 2
                    } else {
                        c2 = e.charCodeAt(n + 1);
                        c3 = e.charCodeAt(n + 2);
                        t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
                        n += 3
                    }
                }
                return t
            }*/
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>