<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" date="2020.09.07">
    <url><![CDATA[https?://(?:www\.)?bilibili\.com/bangumi/play/(?:ep|ss)(?<id>\d+)]]></url>
    <title><![CDATA[<h1\s+title="([^"]+)"]]></title>
    <thumbnail><![CDATA[<meta\s+content="([^"]+)[^>]+property="og:image">]]></thumbnail>
    <duration><![CDATA[duration":(\d+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <ckSign><![CDATA[SESSDATA]]></ckSign>
    <jsCode><![CDATA[
        try {
            var video_url = window.location.href;
            //url格式转换
            if (video_url.indexOf('/play/ss') != -1) {
                var headers = 'Accept-Encoding: gzip, deflate, br';
                var html = window.external.getHtmlCodeEx(video_url, headers);
                var m = html.match(/\{\"loaded\":(?:true|false),\"id\":(\d+)/);
                if (m) 
                    video_url ='https://www.bilibili.com/bangumi/play/ep' + m[1];
             }
            document.body.innerHTML = 'cr_video_url=' + video_url + '$' + document.body.innerHTML;
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>