<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" date="2021.03.12">
    <url><![CDATA[https?://(?:www\.)?bukaivip\.com/.*?/vod/(?:play|detail)/id/(?<id>[^./]+).*?\.html?]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[]]></thumbnail>
    <duration><![CDATA[]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            //https://bukaivip.com/index.php/vod/play/id/1665/sid/1/nid/1.html
            //https://bukaivip.com/index.php/vod/detail/id/1665.html
            var title = document.title;
            var video_url = window.location.href;
            //detail...
            if (window.location.href.indexOf('detail') != -1) {
                title = (document.getElementsByTagName('h1').length != 0) ? document.getElementsByTagName('h1')[0].innerHTML.match(/([^<]+)/)[0] : title;
                video_url = window.location.href;
                for (var i = 0; i <= document.getElementsByClassName('btn btn-primary').length - 1; i++) {
                    if (document.getElementsByClassName('btn btn-primary')[i].href.indexOf('play') != -1) {
                         video_url = document.getElementsByClassName('btn btn-primary')[i].href + '#ra';
                         break;
                    }
                }
            }
            else if (window.player_data) {
                title = document.getElementsByClassName('stui-player__head').length != 0 ? document.body.innerHTML.match(/正在播放：([^<-]+)/)[1] : title;
                video_url = window.player_data.url;
                if (video_url.indexOf('.m3u8') == -1) {
                    var api_url = 'https://cq.mmiyue.com/zhenbuka/player/resourceServerPlayer.php?id=' + video_url;
                    var data = window.external.getHtmlCode(api_url, window.location.href);
                    if (data.indexOf('src=') != -1)
                        video_url = data.match(/src='([^']+)/)[1] + '#ra';
                }
            }

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