<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" date="2021.02.05">
    <url><![CDATA[https?://(?:\w+\.)?huoshan\.com/(?:hotsoon/s/(?<id>[^/]+)|pages/item/index\.html\?item_id=(?<id>[^&.]+)|share/item/(?<id>[^/]+))]]></url>
    <title><![CDATA[title="([^"]+)]]></title>
    <thumbnail><![CDATA[cover":"([^"]+)]]></thumbnail>
    <duration><![CDATA[duration=([^,]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            //https://reflow.huoshan.com/share/item/6725602715323485453
            //https://share.huoshan.com/hotsoon/s/lm1SPJP8Vc8/
            var url = window.external.url;
            if (url.indexOf('item_id') == -1)
                url = window.external.getRedirectedUrl(url, url, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36');
            var title = '', thumbnail = '', duration = 0;
            var video_url = url;
            var m = url.match(/item_id=(\d+)/);
            if (m) {
                var item_id = m[1];
                title = document.title + '_' + item_id;
                duration = 0;
                var html = window.external.getHtmlCode('https://www.ixigua.com/' + item_id + '/');
                if (html && html.match(/<title[^>]*>([^<]+)\s+-/))
                    title = html.match(/<title[^>]*>([^<]+)\s+-/)[1];
                else {
                    html = window.external.getHtmlCode('https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=' + item_id);
                    if (html.indexOf('\"desc\"') != -1)
                        title = html.match(/\"desc\":\"([^\"]+)/)[1];
                    if (html.indexOf('\"duration\"') != -1)
                        duration = parseInt(html.match(/\"duration\":([^,]+)/)[1]) / 1000;
                }
                var api_url = 'https://share.huoshan.com/api/item/info?item_id=' + item_id;
                var data = window.external.getHtmlCode(api_url);
                var video_id = data.match(/video_id=([^&]+)/)[1];
                video_url = 'http://hotsoon.snssdk.com/hotsoon/item/video/_playback/?video_id=' + video_id;
            }
            else if (typeof(gvd) != 'undefined') {
                var data = gvd(window.external.url);
                var jo = JSON.parse(data);
                if (jo.body && jo.body.video_url) {
                    title = jo.body.title;
                    thumbnail = jo.body.cover_url;
                    video_url = jo.body.video_url;
                }
            }
            document.body.innerHTML = 'title=\"' + title + '\",duration=' + duration + ',cr_video_url=' + video_url + '$' + data;
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>