Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
- fix video start
- fix typos
  • Loading branch information
eclipse7723 committed Jul 8, 2024
1 parent cf3993c commit 6d3acbc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "UASerials",
"file": "uaserials.js",
"showtimeVersion": "5",
"version": "0.1.0",
"version": "1.0.0",
"author": "eclipse7723",
"title": "UASerials",
"icon": "logo.svg",
Expand Down
8 changes: 4 additions & 4 deletions src/decrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ function UASJsonParse(plaintext) {
return json;
}

function UASParsePlayerControl(html) {
function UASParsePlayerControl(HTML) {
const pattern = /<player-control\s+([^>]+)><\/player-control>/;

// Поиск тега в строке
const match = html.match(pattern);
const match = HTML.match(pattern);
const attributes = {};
if (match) {
const attributesString = match[1]; // Получаем строку с атрибутами
Expand All @@ -65,8 +65,8 @@ function UASParsePlayerControl(html) {
return attributes;
}

function UASJsonDecrypt(html) {
const playerControlAttributes = UASParsePlayerControl(html);
function UASJsonDecrypt(HTML) {
const playerControlAttributes = UASParsePlayerControl(HTML);

const cipherData = UASJsonParse(playerControlAttributes["data-tag1"]);
const defaultData = playerControlAttributes["data-default"];
Expand Down
25 changes: 24 additions & 1 deletion src/movie-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ function parseTvEpisode(page, movieData, season, episode) {
const sounds = findSoundsByEpisode(movieData, season, episode);

if (!sounds) {
// return;
// error handled in `findSoundsByEpisode`
// console.error("Not found sounds for " + season + " " + episode)
}

sounds.forEach(function(data) {
Expand Down Expand Up @@ -125,4 +126,26 @@ function parseTrailer(page, movieData) {
title: movieData.title
});
})
}

/* видео */

function parseVideoURL(href) {
const cdnSubstring = "://tortuga.wtf/vod/"
if (!href.match(cdnSubstring)) {
console.error("Unknown CDN url '" + href + "' - url must include '" + cdnSubstring + "'")
return null;
}

const HTML = fetchHTML(href);
const pattern = /file: "(.+)"/;
const match = HTML.match(pattern);

if (!match) {
console.error("Not found video url at '" + href + "' with pattern '" + pattern + "'")
return null;
}

const url = match[1];
return url;
}
22 changes: 9 additions & 13 deletions uaserials.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ var currentMovieData;
service.create(PLUGIN.title, PLUGIN.id + ':start', 'video', true, PLUGIN_LOGO);
settings.globalSettings(PLUGIN.id, PLUGIN.title, PLUGIN_LOGO, PLUGIN.synopsis);

// todo: add DEBUG setting
// todo: add quality select if possible
// todo: add button "next page"

/* PAGES */

new page.Route(PLUGIN.id + ":start", function(page) {
Expand All @@ -37,10 +41,6 @@ new page.Route(PLUGIN.id + ":start", function(page) {
page.appendItem(PLUGIN.id + ':search:', 'search', {
title: "Пошук на " + BASE_URL
});

// page.appendItem(PLUGIN.id + ":play-test:", "directory", {
// title: "test"
// })

var categories = [
{name: "Серіали", tag: "/series"},
Expand Down Expand Up @@ -88,7 +88,6 @@ new page.Route(PLUGIN.id + ":list:(.*):(.*)", function(page, href, title) {
new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {
setPageHeader(page, DEFAULT_PAGE_TYPE, PLUGIN.id + " - " + title)

console.log(href, title)
page.loading = true;

const htmlText = fetchHTML(href);
Expand Down Expand Up @@ -138,7 +137,7 @@ new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {
parseTrailer(page, currentMovieData);

page.appendPassiveItem("separator", '', {
title: "Дивитись онлайн"
title: "Дивитись онлайн (HLS)"
});

parseMovie(page, currentMovieData);
Expand All @@ -150,17 +149,14 @@ new page.Route(PLUGIN.id + ":moviepage:(.*):(.*)", function(page, href, title) {
new page.Route(PLUGIN.id + ':play:(.*):(.*)', function(page, href, title) {
setPageHeader(page, "video", PLUGIN.id + " - " + title)

// fixme tortuga.wtf - load video path
// parse this link: <video preload="none" src="GET THIS LINK"></video>

// page.redirect(href);
page.source = href;
const videoURL = parseVideoURL(href);
page.source = videoURL;

page.loading = false;
});

new page.Route(PLUGIN.id + ':play-select-sound:(.*):(.*):(.*)', function(page, title, season, episode) {
setPageHeader(page, "video", PLUGIN.id + " - " + title + " - озвучка")
setPageHeader(page, "directory", PLUGIN.id + " - " + title + " - озвучка")

parseTvEpisode(page, currentMovieData, season, episode);
page.loading = false;
Expand All @@ -178,7 +174,7 @@ function setupSearchPage(page, query) {
page.loading = true;
var url = searchUrl + "&search_start=" + nextPageNumber;

console.log("search at '" + url + "'...");
// console.log("search at '" + url + "'...");

parseMovies(page, url);
nextPageNumber++;
Expand Down

0 comments on commit 6d3acbc

Please sign in to comment.