<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" date="2019.10.29">
    <url><![CDATA[https?://v\.pptv\.com/show/(?<id>\w+)\.html?]]></url>
    <title><![CDATA[title":"([^"]+)"]]></title>
    <thumbnail><![CDATA[<meta\s+content="([^"]+)"\s+property="og:image">]]></thumbnail>
    <duration><![CDATA[duration":([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        var href = window.location.href;
        try {
            if (href.indexOf('#') != -1)
                href = href.substr(0, href.indexOf('#'));
            var url = 'http://web-play.pptv.com/webplay3-0-' + webcfg.id + '.xml?version=6&type=mhpptv&o=0&pageUrl=' + href + '&appver=4.0.7&appplt=web&appid=pptv.web.h5&nddp=1&scver=1&cb=getPlayEncode';
            var html = window.external.getHtmlCode(url);
            var data = html.slice('getPlayEncode='.length, -4);
            var jo = JSON.parse(data);
            for (var i = jo.childNodes.length - 1; i--; i >= 0) {
                if (jo.childNodes[i].tagName == 'dt') {
                    jo = jo.childNodes[i];
                    break;
                }
            }

            var fileName = jo.rid;
            fileName = fileName.replace('mp4', 'm3u8');
            var host = '';
            var key = '';
            for (var i = jo.childNodes.length; i--; i >= 0) {
                var tagName = jo.childNodes[i].tagName;
                if (tagName == 'key')
                    key = jo.childNodes[i].childNodes[0];
                else if (tagName == 'bh')
                    host = jo.childNodes[i].childNodes[0];
            }
            var video_url = 'http://' + host + '/' + fileName + '?fpp.ver=1.0.0&k=' + key + '&type=mhpptv'
            document.body.innerHTML = 'cr_video_url=' + video_url + '$' + document.body.innerHTML;
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>