<?xml version="1.0" encoding="utf-8"?>
<parser delay="2500" crpj="true" date="2020.11.17">
    <url><![CDATA[https?://(?:www\.)?xinpianchang\.com/a(?<id>[^?]+)]]></url>
    <title><![CDATA[<h3[^>]+>([^<]+)</h3>]]></title>
    <thumbnail><![CDATA[cover:\s+'([^']+)']]></thumbnail>
    <duration><![CDATA[duration=([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            var vq = parseInt((window.external.vq && window.external.vq.match(/\d+/) ? window.external.vq : '1080').match(/\d+/)[0]);
            if (vq == 8 || vq == 4)
                vq = 2160;
            else if (vq == 2)
                vq = 1440;
            var vid = this.vid;
            var expand = document.body.innerHTML.match(/expand\s+:\s+\"([^\"]+)\"/)[1];
            var usage = document.body.innerHTML.match(/usage\s+:\s+\"([^\"]+)\"/)[1];
            var url = document.body.innerHTML.match(/requireDomain:\s+\"([^\"]+)\"/)[1];
            var appKey = this.modeServerAppKey;
            url = url + '/v3/video/' + vid + '?expand=' + expand + '&usage=' + usage + '&appKey=' + appKey;
            var data = window.external.getHtmlCode(url);
            var jo = JSON.parse(data);
            var duration = jo.data.video.duration;
            var video_url = jo.data.video.source_link;
            if (jo.data.resource) {
                video_url = jo.data.resource.progressive[0].url;
                for (var v in jo.data.resource.progressive) {
                    if (jo.data.resource.progressive[v].height == vq) {
                        video_url = jo.data.resource.progressive[v].url;
                        break;
                    }
                }
            }

            document.body.innerHTML = 'duration=' + duration / 1000 + ',cr_video_url=' + video_url + '$' + document.body.innerHTML;
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>