<?xml version="1.0" encoding="utf-8"?>
<parser delay="2500" crpj="true" referer="true" date="2020.03.12">
    <url><![CDATA[https?://(?:www\.|ecchi\.)?iwara\.tv/videos/(?<id>[a-zA-Z0-9]+)]]></url>
    <title><![CDATA[<h1[^>]+>([^<]+)</h1>]]></title>
    <thumbnail><![CDATA[<video[^>]+\bposter="([^"]+)"]]></thumbnail>
    <duration><![CDATA[Duration\s+Time</span>([^<]+)]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            var video_url = '';
            //https://www.iwara.tv/videos/yrlloc996gfo04ell 
            if (document.getElementsByClassName('player').length != 0) {
                var iframe = document.getElementsByClassName('player')[0].firstElementChild;
                if (iframe)
                     video_url = decodeURIComponent(iframe.src);
            }
            //https://ecchi.iwara.tv/videos/lq32qib6l9h8r6j33
            if (document.getElementById('video-player_html5_api'))
                video_url = document.getElementById('video-player_html5_api').src;
            if (!video_url) {
                var vid = window.location.href.match(/videos\/([^/]+)/)[1];
                var api_url = 'https://ecchi.iwara.tv/api/video/' + vid;
                var data = window.external.getHtmlCode(api_url);
                var jo = JSON.parse(data);
                var video_url = 'https:' + jo[0].uri;
            }

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