<?xml version="1.0" encoding="utf-8"?>
<parser delay="2500" date="2020.05.06">
    <url><![CDATA[uc\.cn/(?:video|media)\.html?.*?id=(?<id>[^&]+)]]></url>
    <title><![CDATA[<h3[^>]+>([^<]+)</h3>]]></title>
    <thumbnail><![CDATA[<video[^>]+\bposter="([^"]+)"]]></thumbnail>
    <duration><![CDATA[duration=(\d+)]]></duration>
    <mediaUrl><![CDATA[<video[^>]+\bsrc="([^"]+)"]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            var href = window.location.href;
            if (document.getElementsByTagName('video').length == 0) {
                var wm_cid = href.match(/wm_cid=(\d+)/)[1];
                var api_url = 'https://ff.dayu.com/contents/' + wm_cid + '?biz_id=' + globalConfig.biz_id;
                var data = window.external.getHtmlCode(api_url, href);
                var jo = JSON.parse(data);
                var video = jo.data.body.videos[0];
                var thumbnail = jo.data.cover_url;
                var ums_id = video.ums_id;
                var wm_id = jo.data.author_id;
                //不能取chrome之cookie找vpstoken，没有播放，其vpstoken为一不对值
                var headers = window.external.getResponseHeaders(href);
                var token = headers.match(/vpstoken=([^;]+)/)[1];
                api_url = 'http://v.mp.uc.cn/api/vps?token=' + token + '&ums_id=' + ums_id + '&wm_cid=' + wm_cid + '&wm_id=' + wm_id + '&resolution=high';
                data = window.external.getHtmlCode(api_url, href);
                jo = JSON.parse(data);
                var video_url = jo.data.url;
                document.body.innerHTML = '<video src=\"' + video_url + '\" poster=\"' + thumbnail + '\"> duration=' + jo.data.duration + '$' + document.body.innerHTML;
            }
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>