Skip to content

Commit

Permalink
Merge pull request #972 from ilyhalight/dev
Browse files Browse the repository at this point in the history
Update 1.8.1
  • Loading branch information
ilyhalight authored Dec 18, 2024
2 parents e85d244 + 35710e4 commit dda2def
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 44 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
<!-- Придумать как нормально реализовать отображение кнопки в Google Drive -->
<!-- - Исправлена работа Google Drive (#888, #883, #912) -->

# 1.8.1

- Добавлена поддержка Loom (#946, #34)

^ субтиры от сайта не работают до следующего обновления

- Добавлена поддержка домена `madmaxworld.tv` для BannedVideo
- Убрана отправка уведомления о переводе, если перевод уже существует ([ee3a66d0b6ef3c6af7b61136dae0c65df0d74337#commitcomment-150456758](https://github.com/ilyhalight/voice-over-translation/commit/ee3a66d0b6ef3c6af7b61136dae0c65df0d74337#commitcomment-150456758))
- Исправлена работа с некоторыми плейлистами VK Video (если ссылка содержала слитно написанный видео ID) (#971)

# 1.8.0

- Доработана логика поиска видео внутри ShadowDOM (#914)
Expand Down
42 changes: 22 additions & 20 deletions dist/vot-min.user.js

Large diffs are not rendered by default.

141 changes: 135 additions & 6 deletions dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
// @match *://disk.yandex.ru/*
// @match *://youtube.googleapis.com/embed/*
// @match *://*.banned.video/*
// @match *://*.madmaxworld.tv/*
// @match *://*.weverse.io/*
// @match *://*.newgrounds.com/*
// @match *://*.egghead.io/*
Expand All @@ -82,6 +83,7 @@
// @match *://*.porntn.com/*
// @match *://*.dzen.ru/*
// @match *://*.cloudflarestream.com/*
// @match *://*.loom.com/*
// @match *://*/*.mp4*
// @match *://*/*.webm*
// @match *://*.yewtu.be/*
Expand Down Expand Up @@ -174,7 +176,7 @@
// @connect speed.cloudflare.com
// @connect porntn.com
// @namespace vot
// @version 1.8.0
// @version 1.8.1
// @icon https://translate.yandex.ru/icons/favicon.ico
// @author sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD
// @homepageURL https://github.com/ilyhalight/voice-over-translation
Expand Down Expand Up @@ -270,7 +272,7 @@ var es5 = __webpack_require__("./node_modules/bowser/es5.js");
defaultDuration: 343,
minChunkSize: 5295308,
loggerLevel: 1,
version: "2.0.14",
version: "2.0.16",
});

;// ./node_modules/@vot.js/shared/dist/types/logger.js
Expand Down Expand Up @@ -2233,6 +2235,7 @@ var VideoService;
VideoService["porntn"] = "porntn";
VideoService["dzen"] = "dzen";
VideoService["cloudflarestream"] = "cloudflarestream";
VideoService["loom"] = "loom";
})(VideoService || (VideoService = {}));

;// ./node_modules/@vot.js/core/dist/utils/vot.js
Expand Down Expand Up @@ -3746,6 +3749,14 @@ var ExtVideoService;
host: VideoService.cloudflarestream,
url: "stub",
match: /^(watch|embed|iframe|customer-[^.]+).cloudflarestream.com$/,
selector: null,
},
{
host: VideoService.loom,
url: "https://www.loom.com/share/",
match: /^(www.)?loom.com$/,
selector: ".VideoLayersContainer",
needExtraData: true,
},
{
host: VideoService.custom,
Expand Down Expand Up @@ -4794,7 +4805,7 @@ class VimeoHelper extends BaseHelper {
API_KEY = "";
DEFAULT_SITE_ORIGIN = "https://vimeo.com";
SITE_ORIGIN = this.isPrivatePlayer()
? this.service?.url?.slice(0, -1) ?? this.DEFAULT_SITE_ORIGIN
? (this.service?.url?.slice(0, -1) ?? this.DEFAULT_SITE_ORIGIN)
: this.DEFAULT_SITE_ORIGIN;
isErrorData(data) {
return Object.hasOwn(data, "error");
Expand Down Expand Up @@ -5002,7 +5013,7 @@ class VimeoHelper extends BaseHelper {
}
return embedId?.startsWith("video/")
? embedId.replace("video/", "")
: embedId ?? /[^/]+$/.exec(url.pathname)?.[0];
: (embedId ?? /[^/]+$/.exec(url.pathname)?.[0]);
}
}

Expand Down Expand Up @@ -5149,7 +5160,7 @@ class VKHelper extends BaseHelper {
if (pathID) {
return pathID[0].slice(1);
}
const idInsidePlaylist = /\/playlist\/[^/]+\/(video-\d{8,9}_\d{9})/.exec(url.pathname);
const idInsidePlaylist = /\/playlist\/[^/]+\/(video-?\d{8,9}_\d{9})/.exec(url.pathname);
if (idInsidePlaylist) {
return idInsidePlaylist[1];
}
Expand Down Expand Up @@ -5716,6 +5727,114 @@ class DouyinHelper extends BaseHelper {
}
}

;// ./node_modules/@vot.js/shared/dist/types/helpers/bannedvideo.js
var TypeName;
(function (TypeName) {
TypeName["Channel"] = "Channel";
TypeName["Video"] = "Video";
})(TypeName || (TypeName = {}));

;// ./node_modules/@vot.js/shared/dist/types/index.js




















;// ./node_modules/@vot.js/shared/dist/index.js









;// ./node_modules/@vot.js/ext/dist/helpers/loom.js




class LoomHelper extends BaseHelper {
getClientVersion() {
if (typeof SENTRY_RELEASE === "undefined") {
return undefined;
}
const release = SENTRY_RELEASE;
return release?.id;
}
getDefault(videoId) {
if (!this.service) {
return undefined;
}
return {
url: this.service.url + videoId,
duration: undefined,
};
}
async getVideoData(videoId) {
try {
const clientVer = this.getClientVersion();
if (!clientVer) {
throw new VideoHelperError("Failed to get client version");
}
const res = await this.fetch("https://www.loom.com/graphql", {
headers: {
"User-Agent": config.userAgent,
"content-type": "application/json",
"x-loom-request-source": `loom_web_${clientVer}`,
"apollographql-client-name": "web",
"apollographql-client-version": clientVer,
"Alt-Used": "www.loom.com",
},
body: `{"operationName":"FetchCaptions","variables":{"videoId":"${videoId}"},"query":"query FetchCaptions($videoId: ID!, $password: String) {\\n fetchVideoTranscript(videoId: $videoId, password: $password) {\\n ... on VideoTranscriptDetails {\\n id\\n captions_source_url\\n language\\n __typename\\n }\\n ... on GenericError {\\n message\\n __typename\\n }\\n __typename\\n }\\n}"}`,
method: "POST",
});
if (res.status !== 200) {
throw new VideoHelperError("Failed to get data from graphql");
}
const result = (await res.json());
const data = result.data.fetchVideoTranscript;
if (data.__typename === "GenericError") {
throw new VideoHelperError(data.message);
}
return {
url: this.service.url + videoId,
subtitles: [
{
format: "vtt",
language: normalizeLang(data.language),
source: "loom",
url: data.captions_source_url,
},
],
};
}
catch (err) {
Logger.error(`Failed to get Loom video data, because: ${err.message}`);
return this.getDefault(videoId);
}
}
async getVideoId(url) {
return /(embed|share)\/([^/]+)?/.exec(url.pathname)?.[2];
}
}

;// ./node_modules/@vot.js/ext/dist/helpers/index.js


Expand Down Expand Up @@ -5810,6 +5929,8 @@ class DouyinHelper extends BaseHelper {








Expand Down Expand Up @@ -5863,6 +5984,7 @@ const availableHelpers = {
[VideoService.piped]: YoutubeHelper,
[VideoService.dzen]: DzenHelper,
[VideoService.cloudflarestream]: CloudflareStreamHelper,
[VideoService.loom]: LoomHelper,
[ExtVideoService.udemy]: UdemyHelper,
[ExtVideoService.coursera]: CourseraHelper,
[ExtVideoService.douyin]: DouyinHelper,
Expand Down Expand Up @@ -6016,6 +6138,9 @@ function convertSubsToJSON(data, from = "srt") {
if (from === "vtt") {
parts.shift();
}
if (/^\d+\n/.exec(parts?.[0] ?? "")) {
from = "srt";
}
const offset = +(from === "srt");
const subtitles = parts.reduce((result, part) => {
const lines = part.trim().split("\n");
Expand Down Expand Up @@ -11616,7 +11741,11 @@ class VideoHandler {
"afterUpdateTranslation downloadTranslationUrl",
this.downloadTranslationUrl,
);
if (this.data.sendNotifyOnComplete && isSuccess) {
if (
this.data.sendNotifyOnComplete &&
this.longWaitingResCount &&
isSuccess
) {
GM_notification({
text: localizationProvider
.get("VOTTranslationCompletedNotify")
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"postinstall": "patch-package"
},
"dependencies": {
"@vot.js/ext": "^2.0.14",
"@vot.js/shared": "^2.0.14",
"@vot.js/ext": "^2.0.16",
"@vot.js/shared": "^2.0.16",
"bowser": "^2.11.0",
"chaimu": "^1.0.3",
"lit": "^3.2.1",
Expand Down
4 changes: 3 additions & 1 deletion src/headers.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[VOT] - Voice Over Translation",
"description": "A small extension that adds a Yandex Browser video translation to other browsers",
"version": "1.8.0",
"version": "1.8.1",
"author": "sodapng, mynovelhost, Toil, SashaXser, MrSoczekXD",
"namespace": "vot",
"icon": "https://translate.yandex.ru/icons/favicon.ico",
Expand Down Expand Up @@ -37,6 +37,7 @@
"*://disk.yandex.ru/*",
"*://youtube.googleapis.com/embed/*",
"*://*.banned.video/*",
"*://*.madmaxworld.tv/*",
"*://*.weverse.io/*",
"*://*.newgrounds.com/*",
"*://*.egghead.io/*",
Expand All @@ -62,6 +63,7 @@
"*://*.porntn.com/*",
"*://*.dzen.ru/*",
"*://*.cloudflarestream.com/*",
"*://*.loom.com/*",
"*://*/*.mp4*",
"*://*/*.webm*"
],
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,11 @@ class VideoHandler {
"afterUpdateTranslation downloadTranslationUrl",
this.downloadTranslationUrl,
);
if (this.data.sendNotifyOnComplete && isSuccess) {
if (
this.data.sendNotifyOnComplete &&
this.longWaitingResCount &&
isSuccess
) {
GM_notification({
text: localizationProvider
.get("VOTTranslationCompletedNotify")
Expand Down

0 comments on commit dda2def

Please sign in to comment.