<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" date="2021.03.24">
    <url><![CDATA[https?://(?:www\.)?nfmovies\.com/(?:video|detail)/(?<id>[^./]+)]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^\$]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            //https://www.nfmovies.com/detail/61199.html
            //https://www.nfmovies.com/video/61199-2-0.html
            //detail...
            if (window.location.href.indexOf('detail') != -1) {
                var title = (document.getElementsByTagName('h1').length != 0) ? document.getElementsByTagName('h1')[0].innerText : document.title;
                var video_url = window.location.href;
                for (var i = 0; i <= document.getElementsByClassName('btn btn-warm').length - 1; i++) {
                    if (document.getElementsByClassName('btn btn-warm')[i].href.indexOf('video') != -1) {
                         video_url = document.getElementsByClassName('btn btn-warm')[i].href + '#ra';
                         break;
                    }
                }
            }
            else {
                var title = document.getElementsByClassName('tips close-box').length != 0 ? document.body.innerHTML.match(/正在播放：([^<-]+)/)[1] : document.title;
                var thumbnail = document.body.innerHTML.match(/data-pic=/) ? 'https://www.nfmovies.com' + document.body.innerHTML.match(/data-pic=\"([^\"]+)/)[1] : '';
                var video_url = window.now || window.location.href;
            }

            //下载为本地m3u8。网页端，其为图片文件
            if (video_url.indexOf('.m3u8') != -1 && typeof(window.external.saveData) != 'undefined') {
                var data = window.external.getHtmlCode(video_url, window.location.href);
                if (data.indexOf('#EXTM3U') != -1)
                   video_url = window.external.saveData(data);
            }

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