<?xml version="1.0" encoding="utf-8"?>
<parser delay="500" crpj="true" date="2020.10.05">
    <url><![CDATA[https?://(?:y\.)?qq\.com/\w/yqq/song.*?\.html?]]></url>
    <title><![CDATA[<h1[^>]+>([^<]+)</h1>]]></title>
    <thumbnail><![CDATA[data__cover">\s+<img[^>]+src="([^"]+)"]]></thumbnail>
    <duration><![CDATA[interval":([^,]+),]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <ckSign><![CDATA[pgv_pvid]]></ckSign>
    <jsCode><![CDATA[
        try {
            var video_url = '';
            var songmid = g_SongData.songmid;
            var href = window.location.href;
            if (!video_url) {
                var guid = document.cookie.match(/pgv_pvid=(\d+)/)[1];
                var songtype = g_SongData.songtype;
                data = '{\"req_0\":{\"module\":\"vkey.GetVkeyServer\",\"method\":\"CgiGetVkey\",\"param\":{\"guid\":\"' + guid + '\",\"songmid\":[\"' + songmid + '\"],\"songtype\":[' + songtype + '],\"uin\":\"0\",\"loginflag\":1,\"platform\":\"20\"}}}';
                api_url = 'https://u.y.qq.com/cgi-bin/musicu.fcg?format=json&platform=yqq.json&needNewCode=0&data=' + data;
                data = window.external.getHtmlCode(api_url);
                jo = JSON.parse(data);
                if (jo.req_0.data && jo.req_0.data.midurlinfo[0].purl)
                    video_url = jo.req_0.data.sip[0] + jo.req_0.data.midurlinfo[0].purl;
            }

            var href = window.location.href;
            if (!video_url) {
                var args = 'filter=url&type=_&input=' + encodeURIComponent(href);
                var data = window.external.getPostResultEx('https://music.liuzhijin.cn/', args, 'X-Requested-With: XMLHttpRequest\r\nContent-Type: application/x-www-form-urlencoded');
                if (data) {
                    var jo = JSON.parse(data);
                    if (jo.data)
                        video_url = jo.data[0].url;
                }
            }
            if (!video_url)
                video_url = href;

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