tatalin
9/12/2018 - 8:18 AM

emulator.js

curl 'https://redllama.ru/core/ad/?s=97&rid=798123&rf=&lc=https%3A//m.kp.ru/daily/26825.7/3863254/&ow=414&oh=736&sw=414&sh=736&pd=24' - H 'Accept-Encoding: gzip, deflate, br' - H 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' - H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1 229abba2' - H 'Accept: */*' - H 'Referer: https://m.kp.ru/daily/26825.7/3863254/' - H 'Cookie: idntfy=VU0jFTZLpPvH8Yd; mtm_test=test; mtmvid=174856038539856013' - H 'Connection: keep-alive'--compressed(function(w, spot_id, actx) {

        function _jsLoadDelayed(b, c, d) {
            var a = document.createElement("script");
            d && (a.id = d);
            a.language = "javascript";
            a.type = "text/javascript";
            a.charset = "utf-8";
            a.async = 1;
            a.src = b;
            if (window.ActiveXObject) {
                var e = !1;
                a.onload = a.onreadystatechange = function() {
                    if (!e && (!this.readyState || this.readyState === "complete" || this.readyState === "loaded" &&
                            this.nextSibling != null)) {
                        e = true;
                        c && c();
                        a.onload = a.onreadystatechange = null
                    }
                }
            } else
                a.onload = c;
            b = document.getElementsByTagName("script")[0];
            b.parentNode.insertBefore(a, b)
        };

        function cacheFile(u) {
            (new Image(1, 1)).src = u.replace('{r' + 'id}', Math.random());
        }

        _jsLoadDelayed(actx.creative_script_url, function() {

            console.log('loaded creative');
            var sp = actx.creative_script_url.lastIndexOf('/') + 1;
            var assetsPath = actx.creative_script_url.substr(0, sp);
            var funcName = '_MTM_Highmedia_creative';

            new(eval(funcName))({
                'click_url': actx.click_url,
                'proceed_url': actx.proceed_url,
                'assets_path': actx.assets_path,
                'spot_id': spot_id,
                'ad_id': actx.ad_id,
                'stub': actx.stub,
                'onEvent': function(ev) {

                    switch (ev) {
                        case 'ready':
                            cacheFile(actx.impression_url);
                            if (actx.external_track_impression_url.length != 0)
                                cacheFile(actx.external_track_impression_url);
                            if (window._MTM_impressions_cb != null && typeof window._MTM_impressions_cb[spot_id] === "function")
                                window._MTM_impressions_cb[spot_id]();
                            break;
                        case 'close':
                            cacheFile(actx.close_url);
                            break;
                        case 'click':
                            cacheFile(actx.click_url);
                            break;
                        case 'quarter':
                            cacheFile(actx.quarter_url);
                            if (actx.external_track_quarter_url.length != 0)
                                cacheFile(actx.external_track_quarter_url);
                            break;
                        case 'half':
                            cacheFile(actx.half_url);
                            if (actx.external_track_half_url.length != 0)
                                cacheFile(actx.external_track_half_url);
                            break;
                        case 'threequarters':
                            cacheFile(actx.threequarters_url);
                            if (actx.external_track_threequarters_url.length != 0)
                                cacheFile(actx.external_track_threequarters_url);
                            break;
                        case 'complete':
                            cacheFile(actx.complete_url);
                            if (actx.external_track_complete_url.length != 0)
                                cacheFile(actx.external_track_complete_url);
                            break;
                        case 'replay':
                            cacheFile(actx.replay_url);
                            break;

                    }
                }
            });

            (new Image()).src = '//redllama.ru/core/pxr/?s=97&vid=174856038539856013&c=121';

        }, '_mtm_creative_script_' + spot_id);

    })(window, '97', {
            'ad_id': '275',
            'assets_path': '//redllama.ru/storage/upload/0/275/',
            'creative_script_url': '//redllama.ru/storage/upload/0/275/hm_full.js',
            'click_url': '//redllama.ru/core/click/?a=275&s=97&vid=174856038539856013&click_url=' + encodeURIComponent('https://redllama.ru/clients/core/exc.cgi?bid=892&pid=3&cc=895&rid=1' + '&rnd=' + parseInt(Math.random() * 100000).toString()),
            'impression_url': '//redllama.ru/core/impression/?a=275&s=97&rid=1452779093&vid=174856038539856013',
            'close_url': '//redllama.ru/core/tracking/?a=275&s=97&e=8&rid=1452779093&vid=174856038539856013',
            'quarter_url': '//redllama.ru/core/tracking/?a=275&s=97&e=9&rid=1452779093&vid=174856038539856013',
            'half_url': '//redllama.ru/core/tracking/?a=275&s=97&e=10&rid=1452779093&vid=174856038539856013',
            'threequarters_url': '//redllama.ru/core/tracking/?a=275&s=97&e=11&rid=1452779093&vid=174856038539856013',
            'complete_url': '//redllama.ru/core/tracking/?a=275&s=97&e=12&rid=1452779093&vid=174856038539856013',
            'replay_url': '//redllama.ru/core/tracking/?a=275&s=97&e=13&rid=1452779093&vid=174856038539856013',
            'external_track_impression_url': 'https://redllama.ru/clients/core/exd.gif?bid=892&pid=3&cc=895&rid=1',
            'external_track_quarter_url': '',
            'external_track_half_url': '',
            'external_track_threequarters_url': '',
            'external_track_complete_url': '',
            'vid': '174856038539856013',
            'rid': '1452779093',
            'stub': 'noAdredllama();'