diff --git a/online_mod.js b/online_mod.js index f120502..aeff2fc 100644 --- a/online_mod.js +++ b/online_mod.js @@ -1,4 +1,4 @@ -//16.11.2024 - Fix +//17.11.2024 - Fix (function () { 'use strict'; @@ -102,7 +102,6 @@ var user_proxy3 = (proxy_other_url || proxy3) + param_ip; if (name === 'filmix') return window.location.protocol === 'https:' && !Lampa.Platform.is('android') ? user_proxy1 : ''; if (name === 'filmix_site') return user_proxy2; - if (name === 'svetacdn') return ''; if (name === 'zetflix') return proxy_apn; if (name === 'allohacdn') return proxy_other ? proxy_secret : proxy_apn; if (name === 'cookie') return user_proxy1; @@ -111,6 +110,7 @@ if (Lampa.Storage.field('online_mod_proxy_' + name) === true) { if (name === 'iframe') return user_proxy2; + if (name === 'lumex') return user_proxy2; if (name === 'rezka') return user_proxy2; if (name === 'rezka2') return user_proxy2; if (name === 'kinobase') return proxy_apn; @@ -321,31 +321,47 @@ clear: clear }; - function _typeof(obj) { - "@babel/helpers - typeof"; - - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, _typeof(obj); - } - - function videocdn(component, _object) { + function lumex(component, _object) { var network = new Lampa.Reguest(); var extract = {}; var object = _object; - extract.voice = []; + extract.seasons = []; extract.season_num = []; - extract.voice_seasons = {}; - extract.fs = {}; + extract.media = []; var select_title = ''; var prefer_http = Lampa.Storage.field('online_mod_prefer_http') === true; var prefer_mp4 = Lampa.Storage.field('online_mod_prefer_mp4') === true; - var prox = component.proxy('svetacdn'); - var host = (prefer_http ? 'http:' : 'https:') + '//videocdn.tv'; + var prox = component.proxy('lumex'); + var host = atob('aHR0cHM6Ly9wLmx1bWV4LnB3'); var ref = host + '/'; - var embed = atob('Ly85MzcwMy5hbm5hY2RuLmNjL3I5WHJPUW1wRlZ4Tw=='); + var headers = Lampa.Platform.is('android') ? { + 'Origin': host, + 'Referer': ref, + 'Sec-Fetch-Dest': 'empty', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Site': 'same-site' + } : {}; + var headers2 = Lampa.Platform.is('android') ? { + 'Origin': host, + 'Referer': ref, + 'Sec-Fetch-Dest': 'empty', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Site': 'same-site', + 'Cookie': '', + 'x-csrf-token': '' + } : {}; + + if (prox) { + prox += 'param/Origin=' + encodeURIComponent(host) + '/'; + prox += 'param/Referer=' + encodeURIComponent(ref) + '/'; + prox += 'param/Sec-Fetch-Dest=empty/'; + prox += 'param/Sec-Fetch-Mode=cors/'; + prox += 'param/Sec-Fetch-Site=same-site/'; + } + + var prox2 = prox; + var embed = atob('aHR0cHM6Ly9hcGkubHVtZXgucHcv'); + var suffix = atob('Y2xpZW50SWQ9Q1dmS1hMYzFhaklkJmRvbWFpbj1tb3ZpZWxhYi5vbmUmdXJsPW1vdmllbGFiLm9uZQ=='); var filter_items = {}; var choice = { season: 0, @@ -354,34 +370,57 @@ voice_id: 0 }; - function videocdn_search(iframe_src, callback, error) { - var url = (window.location.protocol === 'https:' && !prox ? 'https:' : 'http:') + iframe_src; - + function lumex_search(api, callback, error) { var error_check = function error_check(a, c) { if (a.status == 404 || a.status == 0 && a.statusText !== 'timeout') { if (callback) callback(''); } else if (error) error(network.errorDecode(a, c)); }; - { - var meta = $('head meta[name="referrer"]'); - var referrer = meta.attr('content') || 'never'; - meta.attr('content', 'origin'); + var returnHeaders = true; + var cookie_prox = prox; - try { - network.clear(); - network.timeout(20000); - network["native"](prox + url, callback, error_check, false, { - dataType: 'text', - headers: Lampa.Platform.is('android') ? { - 'Origin': host, - 'Referer': ref - } : {} - }); - } finally { - meta.attr('content', referrer); - } + if (cookie_prox) { + cookie_prox += 'cookie_plus/param/Cookie=/'; + returnHeaders = false; } + + var success_check = function success_check(json) { + var cookie = ''; + + if (json && json.headers && json.body) { + var cookieHeaders = json.headers['set-cookie'] || null; + + if (cookieHeaders && cookieHeaders.forEach) { + var values = {}; + cookieHeaders.forEach(function (param) { + var parts = param.split(';')[0].split('='); + + if (parts[0]) { + if (parts[1] === 'deleted') delete values[parts[0]];else values[parts[0]] = parts[1] || ''; + } + }); + var cookies = []; + + for (var name in values) { + cookies.push(name + '=' + values[name]); + } + + cookie = cookies.join('; '); + } + + json = typeof json.body === 'string' ? Lampa.Arrays.decodeJson(json.body, {}) : json.body; + } + + callback(json, cookie); + }; + + network.clear(); + network.timeout(10000); + network["native"](cookie_prox + api, success_check, error_check, false, { + headers: headers, + returnHeaders: returnHeaders + }); } /** * Начать поиск @@ -394,13 +433,27 @@ object = _object; select_title = object.search || object.movie.title; var error = component.empty.bind(component); - var iframe_src = data[0] && data[0].iframe_src; - var src = iframe_src ? iframe_src.replace(/^\/\/[^\/]+\/[^\/?]+/, embed) : Lampa.Utils.addUrlComponent(embed, (+kinopoisk_id ? 'kp_id=' : 'imdb_id=') + kinopoisk_id); - videocdn_search(src, function (str) { - if (str) parse(str);else if (!iframe_src && !object.clarification && object.movie.imdb_id && kinopoisk_id != object.movie.imdb_id) { - var src2 = Lampa.Utils.addUrlComponent(embed, 'imdb_id=' + object.movie.imdb_id); - videocdn_search(src2, function (str) { - if (str) parse(str);else component.emptyForQuery(select_title); + var found = false; + var src = embed + 'content'; + + if (data[0] && data[0].content_type && data[0].id) { + found = true; + src = Lampa.Utils.addUrlComponent(src, 'contentType=' + encodeURIComponent(data[0].content_type)); + src = Lampa.Utils.addUrlComponent(src, 'contentId=' + encodeURIComponent(data[0].id)); + } else { + src = Lampa.Utils.addUrlComponent(src, 'contentType=short'); + src = Lampa.Utils.addUrlComponent(src, (+kinopoisk_id ? 'kpId=' : 'imdbId=') + encodeURIComponent(kinopoisk_id)); + } + + src = Lampa.Utils.addUrlComponent(src, suffix); + lumex_search(src, function (json, cookie) { + if (json) success(json, cookie);else if (!found && !object.clarification && object.movie.imdb_id && kinopoisk_id != object.movie.imdb_id) { + var src2 = embed + 'content'; + src2 = Lampa.Utils.addUrlComponent(src2, 'contentType=short'); + src2 = Lampa.Utils.addUrlComponent(src2, 'imdbId=' + encodeURIComponent(object.movie.imdb_id)); + src2 = Lampa.Utils.addUrlComponent(src2, suffix); + lumex_search(src2, function (json, cookie) { + if (json) success(json, cookie);else component.emptyForQuery(select_title); }, error); } else component.emptyForQuery(select_title); }, error); @@ -456,274 +509,50 @@ network.clear(); extract = null; }; - /** - * Получить потоки - * @param {String} str - * @returns array - */ - - - function extractItems(str) { - if (!str) return []; - - try { - var items = component.parsePlaylist(str).map(function (item) { - var quality = item.label.match(/(\d\d\d+)p/); - var file = item.links[0] || ''; - if (file) file = (prefer_http ? 'http:' : 'https:') + file; - if (prefer_mp4) file = file.replace(/(\.mp4):hls:manifest\.m3u8$/i, '$1'); - return { - label: item.label, - quality: quality ? parseInt(quality[1]) : NaN, - file: file - }; - }); - items.sort(function (a, b) { - if (b.quality > a.quality) return 1; - if (b.quality < a.quality) return -1; - if (b.label > a.label) return 1; - if (b.label < a.label) return -1; - return 0; - }); - return items; - } catch (e) {} - - return []; - } - function decode(pass, src) { - var pass_len = pass.length; - var pass_arr = Array.from(pass, function (c) { - return c.charCodeAt(0); - }); - var src_len = src.length; - var res = []; - - for (var i = 0; i < src_len; i += 2) { - var hex = src.slice(i, i + 2); - var code = parseInt(hex, 16); - var secret = pass_arr[i / 2 % pass_len] % 255; - res.push(code ^ secret); - } - - return res.map(function (code) { - return String.fromCharCode(code); - }).join(''); - } - - function searchFs(client_id, str) { - var regex = /id="[^"]*" value='([0-9a-f]+)'/g; - var found; - - while ((found = regex.exec(str)) !== null) { - var fs = decode(client_id, found[1]); - if (startsWith(fs, '{"')) return fs; - } - - return ''; - } - - function parse(str) { + function success(json, cookie) { component.loading(false); - str = (str || '').replace(/\n/g, ''); - var voices = str.match(/
\s*(