<?xml version="1.0" encoding="utf-8"?>
<parser delay="2500" crpj="true" date="2021.01.18">
    <url><![CDATA[https?://(?:\w+\.)?baidu\.com/webpage.*?type=live.*?room_id=(?<id>[^&]+)]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[duration=([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            //http://mbd.baidu.com/webpage?type=live&action=liveshow&live_type=review&room_id=4140359441&qq-pf-to=pcqq.group
            var url = window.external.url;
            var title = (document.getElementsByClassName('title-name').length != 0) ? document.getElementsByClassName('title-name')[0].innerText : document.title;
            var room_id = url.match(/room_id=([^&]+)/)[1];
            var device_id = window.initData.deviceId;
            var args = '{\"room_id\":\"' + room_id + '\",\"device_id\":\"' + device_id + '\",\"_\":' + Date.now() + '}';
            var api_url = 'http://mbd.baidu.com/searchbox?cmd=149&action=star&osname=baiduboxapp&data=' +  encodeURIComponent(args);
            var data = window.external.getHtmlCode(api_url, url);
            var jo = JSON.parse(data);
            var video = jo.data['149'].video;
            title = video.title || title;
            var thumbnail = video.cover.cover_100;
            var duration = jo.data['149'].replay_list[0].duration;
            var video_url = jo.data['149'].replay_list[0].video;

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