<?xml version="1.0" encoding="utf-8"?>
<parser delay="500" referer="true" date="2021.04.09">
    <url><![CDATA[https?://(?:\w+\.)?gdtv\.cn/tv/(?<id>[^/]+)]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            //https://www.gdtv.cn/tv/2aebfdddbf42afbcb803ec0e0548745b
            var title = document.body.innerHTML.match(/index__tv-title[^>]+>([^<]+)/) ? document.body.innerHTML.match(/index__tv-title[^>]+>([^<]+)/)[1] : document.title;
            var thumbnail = '';
            var video_url = window.location.href;
            var video = document.getElementById('video_html5_api');
            if (video) {
                thumbnail = video.poster;
                video_url = video.innerHTML.match(/src=\"([^\"]+)/)[1];
            }
            //...
            else {
                var id = window.external.url.match(/tv\/([^/]+)/)[1];
                var api_url = 'https://gdtv-api.gdtv.cn:7443/api/news/v1/news/' + id;
                var t = (new Date).getTime();
                var c = ''.concat('GET', '\n').concat(api_url, '\n').concat(t, '\n').concat('');
                var r = {};
                function s(e) {
                    if (r[e])
                        return r[e].exports;
                    var t = r[e] = {
                        i: e,
                        l: !1,
                        exports: {}
                    };
                    var f = window.webpackJsonp[0][1][e];
                    return f.call(t.exports, t, t.exports, s),
                    t.l = !0,
                    t.exports
                };

                s(378), s(263);
                var fx = s(36).HmacSHA256;
                var rt = fx(c, 'dfkcY1c3sfuw0Cii9DWjOUO3iQy2hqlDxyvDXd1oVMxwYAJSgeB6phO8eW1dfuwX');
                var sn = stringify(rt);
                var headers = 'X-ITOUCHTV-Ca-Key: 89541443007807288657755311869534\r\n\X-ITOUCHTV-Ca-Timestamp: ' + t + '\r\n\X-ITOUCHTV-Ca-Signature: ' + sn;
                var data = window.external.getHtmlCodeEx('https://gdtv-api.gdtv.cn:7443/api/news/v1/news/2aebfdddbf42afbcb803ec0e0548745b', headers);
                if (data) {
                    var jo = JSON.parse(data);
                    title = jo.title;
                    thumbnail = jo.coverUrl;
                    var vps = JSON.parse(jo.video.playUrl);
                    video_url = vps.fhd || vps.hd || vps.sd;
                }
            }
            document.body.innerHTML = 'title=\"' + title + '\",thumbnail=' + thumbnail + ',cr_video_url=' + video_url + '$';
            
            function stringify(e) {
                var t = e.words
                  , n = e.sigBytes
                  , r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
                e.clamp();
                for (var i = [], o = 0; o < n; o += 3)
                    for (var u = (t[o >>> 2] >>> 24 - o % 4 * 8 & 255) << 16 | (t[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255) << 8 | t[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, a = 0; a < 4 && o + .75 * a < n; a++)
                        i.push(r.charAt(u >>> 6 * (3 - a) & 63));
                var l = r.charAt(64);
                if (l)
                    for (; i.length % 4; )
                        i.push(l);
                return i.join('')
            }
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>