Free javascript Hosting


rezka1-1-1.js

Uploaded on Nov 22 2021 18:09 by galunnchik

(function () {
'use strict';

function component(object) {
var network = new Lampa.Reguest();
var scroll = new Lampa.Scroll({
mask: true,
over: true
});
var files = new Lampa.Files(object);
var filter = new Lampa.Filter(object);
var results = [];
var filtred = [];
var extract = {};
var token = '3i40G5TSECmLF77oAqnEgbx61ZWaOYaE';
var last;
var filmname;
var link1080p;
var result_film;
var last_filter;
var filter_items = {
season: [],
voice: [],
voice_info: []
};
var filter_translate = {
season: 'Сезон',
voice: 'Перевод'
};
scroll.minus();
scroll.body().addClass('torrent-list');

this.create = function () {
var _this = this;

this.activity.loader(true);
Lampa.Background.immediately(Lampa.Utils.cardImgBackground(object.movie));
//filmname=encodeURIComponent(object.search)
//xhr.open('GET', 'https://kinopoiskapiunofficial.tech/api/v2.1/films/search-by-keyword?keyword=' + filmname+'&page=1', false);

filmname=encodeURIComponent(object.search)
var url = 'https://kinopoiskapiunofficial.tech/api/v2.1/films/search-by-keyword?keyword='+ filmname;// + (object.movie.number_of_seasons ? 'tv-series' : 'movies');
//url = Lampa.Utils.addUrlComponent(url, 'api_token=' + token);
//url = Lampa.Utils.addUrlComponent(url, 'keyword=' + encodeURIComponent(object.search));
//if (object.movie.release_date && object.movie.release_date !== '0000') url = Lampa.Utils.addUrlComponent(url, 'year=' + (object.movie.release_date + '').slice(0, 4));
var xhr = new XMLHttpRequest();
var xhr2 = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.setRequestHeader('X-API-KEY','2d55adfd-019d-4567-bbf7-67d503f61b5a');
xhr.send();
/*network.silent(url,function (json)
{

if (json.data && json.data.length) {
results = json.data;

_this.build();

_this.activity.loader(false);

_this.activity.toggle();
} else _this.empty('Ой, мы не нашли (' + object.search + ')');
}, function (a, c) {
_this.empty('Ответ: ' + network.errorDecode(a, c));
},'',{X-API-KEY: '2d55adfd-019d-4567-bbf7-67d503f61b5a'});*/
//network.silent(url,
xhr.onload = function () {
var results_films = xhr.responseText;
//if (xhr.response && json.data.length) //
if (xhr.status == 200)

{
var results_filmsJSON = JSON.parse(String(results_films));
result_film = results_filmsJSON.films[0].filmId;

xhr2.open('GET', 'https://voidboost.net/embed/' + result_film, true);
xhr2.send();

}
else _this.empty('Ой, мы не нашли на кинопоиске (' + object.search + ')');
};

xhr.onerror = function (a, c) {
_this.empty('Ответ: ' + network.errorDecode(a, c));
};
xhr2.onload = function () {
if (xhr2.status == 200)
{
var resp = xhr2.responseText;
var videos = resp.match("file': '(.*?)'");//!!!!!!!!!!!!!!!!!!!!!!!!
var video_1080p = videos[0].match("1080p(.*?)mp4");
link1080p = video_1080p[0].match("http(.*?)mp4");
var translation_token = resp.match('<option data-token="(.*?)" data-d="" value="(.*?)">(.*?)<'); //Кривой парсинг
console.log(translation_token[3] + ': ' + link1080p[0]);

results = resp;

_this.build();

_this.activity.loader(false);

_this.activity.toggle();

}
}
filter.onSearch = function (value) {
Lampa.Activity.replace({
search: value,
clarification: true
});
};

filter.onBack = function () {
_this.start();
};

filter.render().find('.selector').on('hover:focus', function (e) {
last_filter = e.target;
});
filter.render().find('.filter--sort').remove();
return this.render();
};

this.empty = function (descr) {
var empty = new Lampa.Empty({
descr: descr
});
files.append(empty.render(filter.empty()));
this.start = empty.start;
this.activity.loader(false);
this.activity.toggle();
};
//Добавление различных фильтров
//TODO
//<select name="translator" id="translator-name" data-select="1"><option data-token="" data-d="" value="0">Перевод</option><option data-token="50de9ebb33df190cff37a5f12ce1314d" data-d="" value="210">Дубляж</option><option data-token="250b69679736d34d16bc195ddc76ed05" data-d="" value="120">Jaskier</option><option data-token="324fc1184a71e3b763ecd8397b6ef227" data-d="" value="200">Субтитры</option><option data-token="4103b40d7c09a37dad9ee5467b51d75b" data-d="" value="5630">Украинский дубляж</option><option data-token="7754deaba60acb1a99b3f80ca195765f" data-d="" value="6270">Pazl Voice</option></select> </div>
//
this.buildFilterd = function (select_season) {

var select = [];

var add = function add(type, title) {
var need = Lampa.Storage.get('online_filter', '{}');
var items = filter_items[type];
var subitems = [];
var value = need[type];
items.forEach(function (name, i) {
subitems.push({
title: name,
selected: value == i,
index: i
});
});
select.push({
title: title,
subtitle: items[value],
items: subitems,
stype: type
});
};

filter_items.voice = [];
filter_items.season = [];
filter_items.voice_info = [];
var choice = {
season: 0,
voice: 0
};
results.slice(0, 1).forEach(function (movie)
{
if (movie.season_count) {
var s = movie.season_count;

while (s--) {
filter_items.season.push('Сезон ' + (movie.season_count - s));
}

choice.season = typeof select_season == 'undefined' ? filter_items.season.length - 1 : select_season;
}

if (filter_items.season.length) {
movie.episodes.forEach(function (episode) {
if (episode.season_num == choice.season + 1) {
episode.media.forEach(function (media) {
if (filter_items.voice.indexOf(media.translation.smart_title) == -1) {
filter_items.voice.push(media.translation.smart_title);
filter_items.voice_info.push({
id: media.translation.id
});
}
});
}
});
}
else
{
movie.translations.forEach(function (element) {
filter_items.voice.push('default');
filter_items.voice_info.push({
//id: element.id
id: 0
});
});
}
});
Lampa.Storage.set('online_filter', object.movie.number_of_seasons ? choice : {});
select.push({
title: 'Сбросить фильтр',
reset: true
});

if (object.movie.number_of_seasons) {
add('voice', 'Перевод');
add('season', 'Сезон');
}

filter.set('filter', select);
this.selectedFilter();
};

this.selectedFilter = function () {
var need = Lampa.Storage.get('online_filter', '{}'),
select = [];

for (var i in need) {
select.push(filter_translate[i] + ': ' + filter_items[i][need[i]]);
}

filter.chosen('filter', select);
};

this.extractFile = function (str, max_quality) {
var url = '';

try {
var items = str.split(',').map(function (item) {
return {
quality: parseInt(item.match(/\[(\d+)p\]/)[1]),
file: item.replace(/\[\d+p\]/, '').split(' or ')[0]
};
});
items.sort(function (a, b) {
return b.quality - a.quality;
});
url = items[0].file;
url = 'http:' + url.slice(0, url.lastIndexOf('/')) + '/' + (max_quality || items[0].quality) + '.mp4';
} catch (e) {}

return url;
};
/*this.extractData2 = function () {
network["native"](link1080p, function (raw) {
var text = document.createElement("textarea");
text.innerHTML = 'default'; //Для фильмов распарсить select name="translator"
}, false, false, {
dataType: 'text'
});
};*/

//Тут парсим ссылки на фильмы
this.extractData2 = function () {
var _this2 = this;

network.timeout(5000);


network["native"]('https://voidboost.net/embed/' + result_film, function (raw) {
var text = document.createElement("textarea");
//[360p]//cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/24048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/24048f47e672d54b0705f487cf141f6b042,[480p]//cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/36048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/36048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/24048f47e672d54b0705f487cf141f6b042,[720p]//cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/48048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/48048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/36048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/24048f47e672d54b0705f487cf141f6b042,[1080p]//cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/72048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/72048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/48048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/36048f47e672d54b0705f487cf141f6b042 or //cloud.cdnland.in/movies/71ebf9f82d190faabdb1c1292d609299debff90a/ca76ba65f2b2c1991c9d5d44c6aebe8b:2021112310/24048f47e672d54b0705f487cf141f6b042
text.innerHTML = 'default';


}, false, false, {
dataType: 'text'
});

};
this.extractData = function () {
var _this2 = this;

network.timeout(5000);
var movie = results.slice(0, 1)[0];
extract = {};

if (movie) {
var src = movie.iframe_src; // movie.iframe_src.replace('58.svetacdn.in/0HlZgU1l1mw5','4432.svetacdn.in/Z9w3z4ZBIQxF')

network["native"]('http:' + src, function (raw) {
var math = raw.replace(/\n/g, '').match(/id="files" value="(.*?)"/);

if (math) {
var json = Lampa.Arrays.decodeJson(math[1].replace(/&quot;/g, '"'), {});
var text = document.createElement("textarea");

var _loop = function _loop(i) {
var _movie$media, _movie$media$filter$;

if (0 === i - 0) {
return "continue";
}

text.innerHTML = json[i];
Lampa.Arrays.decodeJson(text.value, {});
var max_quality = (_movie$media = movie.media) === null || _movie$media === void 0 ? void 0 : (_movie$media$filter$ = _movie$media.filter(function (obj) {
return obj.translation_id === i - 0;
})[0]) === null || _movie$media$filter$ === void 0 ? void 0 : _movie$media$filter$.max_quality;

if (!max_quality) {
var _movie$translations, _movie$translations$f;

max_quality = (_movie$translations = movie.translations) === null || _movie$translations === void 0 ? void 0 : (_movie$translations$f = _movie$translations.filter(function (obj) {
return obj.id === i - 0;
})[0]) === null || _movie$translations$f === void 0 ? void 0 : _movie$translations$f.max_quality;
}

extract[i] = {
json: Lampa.Arrays.decodeJson(text.value, {}),
file: _this2.extractFile(json[i], max_quality)
};

for (var a in extract[i].json) {
var elem = extract[i].json[a];

if (elem.folder) {
for (var f in elem.folder) {
var folder = elem.folder[f];
folder.file = _this2.extractFile(folder.file, max_quality);
}
} else elem.file = _this2.extractFile(elem.file, max_quality);
}
};

for (var i in json) {
var _ret = _loop(i);

if (_ret === "continue") continue;
}
}
}, false, false, {
dataType: 'text'
});
}
};

this.build = function () {
var _this3 = this;

//this.buildFilterd(); //Постройка фильтров
this.filtred(); //Основной список
this.extractData2();//

/*filter.onSelect = function (type, a, b) {
if (type == 'filter') {
if (a.reset) {
_this3.buildFilterd();
} else {
if (a.stype == 'season') {
_this3.buildFilterd(b.index);
} else {
var filter_data = Lampa.Storage.get('online_filter', '{}');
filter_data[a.stype] = b.index;
a.subtitle = b.title;
Lampa.Storage.set('online_filter', filter_data);
}
}
}

_this3.applyFilter();
*/
_this3.start();
//};

this.showResults();
};
//Распарс озвучек из
//<select name="translator" id="translator-name" data-select="1"><option data-token="" data-d="" value="0">Перевод</option><option data-token="50de9ebb33df190cff37a5f12ce1314d" data-d="" value="210">Дубляж</option><option data-token="250b69679736d34d16bc195ddc76ed05" data-d="" value="120">Jaskier</option><option data-token="324fc1184a71e3b763ecd8397b6ef227" data-d="" value="200">Субтитры</option><option data-token="4103b40d7c09a37dad9ee5467b51d75b" data-d="" value="5630">Украинский дубляж</option><option data-token="7754deaba60acb1a99b3f80ca195765f" data-d="" value="6270">Pazl Voice</option></select> </div>
//
this.filtred = function () {
filtred = [];
var filter_data = Lampa.Storage.get('online_filter', '{}');

if (object.movie.number_of_seasons) {
results.slice(0, 1).forEach(function (movie) {
movie.episodes.forEach(function (episode) {
if (episode.season_num == filter_data.season + 1) {
episode.media.forEach(function (media) {
if (media.translation.id == filter_items.voice_info[filter_data.voice].id) {
filtred.push({
episode: parseInt(episode.num),
season: episode.season_num,
title: episode.num + ' - ' + episode.ru_title,
quality: media.max_quality + 'p',
translation: media.translation_id
});
}
});
}
});
});
} else {
// var trans=results.match("id="translator-name"(.*?)"</option>);
//results.slice(0, 1).forEach(function (movie) {
//movie.media.forEach(function (element) {
filtred.push({
//title: element.translation.title,
title: 'Default',
//quality: element.max_quality + 'p',
quality: '1080p',
//translation: element.translation_id
translation: 0
});
//});
// });
}
};

this.applyFilter = function () {
this.filtred();
this.selectedFilter();
this.reset();
this.showResults();
last = scroll.render().find('.torrent-item:eq(0)')[0];
};

this.showResults = function (data) {
filter.render().addClass('torrent-filter');
scroll.append(filter.render());
this.append(filtred);
files.append(scroll.render());
};

this.reset = function () {
last = false;
filter.render().detach();
scroll.clear();
};

this.getFile = function (element, max_quality, show_error) {
var translat = extract[element.translation];
var id = element.season + '_' + element.episode;
var file = '';

if (translat) {
if (element.season) {
for (var i in translat.json) {
var elem = translat.json[i];

if (elem.folder) {
for (var f in elem.folder) {
var folder = elem.folder[f];

if (folder.id == id) {
file = folder.file;
break;
}
}
} else if (elem.id == id) {
file = elem.file;
break;
}
}
} else {
file = translat.file;
}
}

max_quality = parseInt(max_quality);
file=link1080p[0];
/*if (file) {
if (file.split('/').pop().replace('.mp4', '') !== max_quality) {
file = file.slice(0, file.lastIndexOf('/')) + '/' + max_quality + '.mp4';
}
} else if (show_error) Lampa.Noty.show('Не удалось извлечь ссылку');
*/
return file;
};

this.append = function (items) {
var _this4 = this;

items.forEach(function (element) {
var hash = Lampa.Utils.hash(element.season ? [element.season, element.episode, object.movie.original_title].join('') : object.movie.original_title);
var view = Lampa.Timeline.view(hash);
var item = Lampa.Template.get('online_rezka', element);
item.append(Lampa.Timeline.render(view));
item.on('hover:focus', function (e) {
last = e.target;
scroll.update($(e.target), true);
}).on('hover:enter', function () {
if (object.movie.id) Lampa.Favorite.add('history', object.movie, 100);

var file = _this4.getFile(element, element.quality, true);

if (file) {
_this4.start();

var playlist = [];
var first = {
url: file,
timeline: view,
title: element.season ? element.title : object.movie.title + ' / ' + element.title
};
Lampa.Player.play(first);

if (element.season) {
items.forEach(function (elem) {
playlist.push({
title: elem.title,
url: _this4.getFile(elem, elem.quality)
});
});
} else {
playlist.push(first);
}

Lampa.Player.playlist(playlist);
}
});
scroll.append(item);
});
};

this.back = function () {
Lampa.Activity.backward();
};

this.start = function () {
Lampa.Controller.add('content', {
toggle: function toggle() {
Lampa.Controller.collectionSet(scroll.render(), files.render());
Lampa.Controller.collectionFocus(last || false, scroll.render());
},
up: function up() {
if (Navigator.canmove('up')) {
if (scroll.render().find('.selector').slice(2).index(last) == 0 && last_filter) {
Lampa.Controller.collectionFocus(last_filter, scroll.render());
} else Navigator.move('up');
} else Lampa.Controller.toggle('head');
},
down: function down() {
Navigator.move('down');
},
right: function right() {
Navigator.move('right');
},
left: function left() {
if (Navigator.canmove('left')) Navigator.move('left');else Lampa.Controller.toggle('menu');
},
back: this.back
});
Lampa.Controller.toggle('content');
};

this.pause = function () {};

this.stop = function () {};

this.render = function () {
return files.render();
};

this.destroy = function () {
network.clear();
files.destroy();
scroll.destroy();
results = null;
network = null;
};
}

function startPlugin() {
window.plugin_hdrezka_ready = true;
Lampa.Component.add('HDRezka', component);
Lampa.Template.add('button_hdrezka', "<div class=\"full-start__button selector view--online\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:svgjs=\"http://svgjs.com/svgjs\" version=\"1.1\" width=\"512\" height=\"512\" x=\"0\" y=\"0\" viewBox=\"0 0 30.051 30.051\" style=\"enable-background:new 0 0 512 512\" xml:space=\"preserve\" class=\"\">\n <g xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19.982,14.438l-6.24-4.536c-0.229-0.166-0.533-0.191-0.784-0.062c-0.253,0.128-0.411,0.388-0.411,0.669v9.069 c0,0.284,0.158,0.543,0.411,0.671c0.107,0.054,0.224,0.081,0.342,0.081c0.154,0,0.31-0.049,0.442-0.146l6.24-4.532 c0.197-0.145,0.312-0.369,0.312-0.607C20.295,14.803,20.177,14.58,19.982,14.438z\" fill=\"currentColor\"/>\n <path d=\"M15.026,0.002C6.726,0.002,0,6.728,0,15.028c0,8.297,6.726,15.021,15.026,15.021c8.298,0,15.025-6.725,15.025-15.021 C30.052,6.728,23.324,0.002,15.026,0.002z M15.026,27.542c-6.912,0-12.516-5.601-12.516-12.514c0-6.91,5.604-12.518,12.516-12.518 c6.911,0,12.514,5.607,12.514,12.518C27.541,21.941,21.937,27.542,15.026,27.542z\" fill=\"currentColor\"/>\n </g></svg>\n\n <span>\u041E\u043D\u043B\u0430\u0439\u043D</span>\n </div>");
Lampa.Template.add('online_rezka', "<div class=\"online selector\">\n <div class=\"online__body\">\n <div class=\"online__title\">{title}</div>\n <div class=\"online__quality\">HDRezka {quality}</div>\n </div>\n </div>");
Lampa.Listener.follow('full', function (e) {
if (e.type == 'complite') {
var btn = Lampa.Template.get('button_hdrezka');
btn.on('hover:enter', function () {
Lampa.Activity.push({
url: '',
title: 'HDRezka',
component: 'HDRezka',
search: e.data.movie.title,
search_one: e.data.movie.title,
search_two: e.data.movie.original_title,
movie: e.data.movie,
page: 1
});
});
e.object.activity.render().find('.view--torrent').after(btn);
}
});
}

if (!window.plugin_hdrezka_ready) startPlugin();

})();

Back to list