<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" cookies="false" date="2021.03.04">
    <url><![CDATA[https?://(?:www\.)?le\.com/ptv/vplay/(?<id>\d+)\.html?]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[duration=([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <ckSign><![CDATA[ssouid]]></ckSign>
    <jsCode><![CDATA[
        try {
            //cookie影响死活不返回，加set标记
            //http://www.le.com/ptv/vplay/2050778.html?ch2=baidu_ffdsj_21#vid=2050778
            var title = this.__INFO__.video.title || document.title.substr(0, document.title.indexOf(' - '));
            var thumbnail = this.__INFO__.video.videoPic;
            var duration = this.__INFO__.video.duration;
            var video_url = window.location.href;
            //vip...
            if (this.__INFO__.isPay) {
                var vid = this.__INFO__.vid;
                var tkey = gmk(Date.now() / 1e3);
                var args = 'id=' + vid + '&tkey=' + tkey + '&platid=1&splatid=103&tss=ios&domain=www.le.com&source=1001&region=cn';
                var api_url = 'http://player-pc.le.com/mms/out/video/playJson?' + args;
                var data = window.external.getHtmlCode(api_url, window.location.href);
                if (data && data.indexOf('playurl') != -1) {
                    var jo = JSON.parse(data);
                    var pu = jo.msgs.playurl;
                    title = pu.title;
                    thumbnail = pu.pic;
                    duration = pu.duration;
                    args = '&token=' + jo.msgs.yuanxian.token + '&uid=' + jo.msgs.yuanxian.ssouid + '&format=1&expect=3&termid=2&vid=' + vid + '&tzm=';
                    var dp = pu.dispatch['1080p'] || pu.dispatch['1000'];
                    api_url = pu.domain[0] + dp[0] + args;
                    data = window.external.getHtmlCode(api_url, window.location.href);
                    //避免无效字符错误
                    if (data && data.indexOf('location') != -1)
                        video_url = data.match(/location\":\s*\"([^\"]+)/)[1].replace(/\\/g, '');
                }
            }
            //置html[0]不行
            document.head.innerHTML = '';
            document.body.innerHTML = 'title=\"' + title + '\",thumbnail=' + thumbnail + ',duration=' + duration + ',cr_video_url=' + video_url + '$';

            //...
            function gmk(e) {
                var t = 185025305, r = 8, n = e;
                n = rr(n, r);
                var o = n ^ t;
                return o;
            }

            function rr(e, t) {
                for (var r, n = 0; t > n; n++)
                    r = 1 & e,
                    e >>= 1,
                    r <<= 31,
                    e += r;
                return e
            }
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>