Skip to content

Commit

Permalink
fix google drive
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyhalight committed Aug 9, 2024
1 parent a4cc7fb commit 13999a7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Добавлена поддержка большего числа инстансов Peertube
- Добавлена поддержка Poketube (#726)
- Исправлена работа Peertube
- Исправлена работа Google Drive

# 1.6.0

Expand Down
2 changes: 1 addition & 1 deletion dist/vot-min.user.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/vot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3742,7 +3742,7 @@ async function getVideoID(service, video) {
return /\/video\/(\d+)/.exec(url.pathname)?.[1];
}
case VideoService.googledrive:
return /\/file\/d\/([^/]+)/.exec(url.pathname)?.[1];
return url.searchParams.get("docid");
case VideoService.bannedvideo: {
return url.searchParams.get("id");
}
Expand Down Expand Up @@ -3860,6 +3860,7 @@ class VOTLocalizedError extends Error {




const { /* version */ "rE": version } = package_namespaceObject;
class VOTJSError extends Error {
data;
Expand Down Expand Up @@ -4047,6 +4048,7 @@ class VOTClient {
throw new VOTLocalizedError("requestTranslationFailed", res);
}
const translationData = res.data;
utils_debug.log("requestTranslation", translationData);
switch (translationData.status) {
case "failed":
throw new VOTJSError("Yandex couldn't translate video", translationData);
Expand Down
33 changes: 33 additions & 0 deletions patches/vot.js+1.0.2+016+fix-google-drive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/node_modules/vot.js/dist/client.js b/node_modules/vot.js/dist/client.js
index 903b604..e2d8f94 100644
--- a/node_modules/vot.js/dist/client.js
+++ b/node_modules/vot.js/dist/client.js
@@ -8,6 +8,7 @@ import { getVideoData } from "./utils/videoData.js";
import { convertVOT } from "./utils/vot.js";
import { StreamInterval } from "./protos/yandex.js";
import { VOTLocalizedError } from "../../../src/utils/VOTLocalizedError.js";
+import debug from "../../../src/utils/debug.js";
const { version } = packageInfo;
class VOTJSError extends Error {
data;
@@ -195,6 +196,7 @@ export default class VOTClient {
throw new VOTLocalizedError("requestTranslationFailed", res);
}
const translationData = res.data;
+ debug.log("requestTranslation", translationData);
switch (translationData.status) {
case "failed":
throw new VOTJSError("Yandex couldn't translate video", translationData);
diff --git a/node_modules/vot.js/dist/utils/videoData.js b/node_modules/vot.js/dist/utils/videoData.js
index 5e0a547..158f35a 100644
--- a/node_modules/vot.js/dist/utils/videoData.js
+++ b/node_modules/vot.js/dist/utils/videoData.js
@@ -210,7 +210,7 @@ export async function getVideoID(service, video) {
return /\/video\/(\d+)/.exec(url.pathname)?.[1];
}
case VideoService.googledrive:
- return /\/file\/d\/([^/]+)/.exec(url.pathname)?.[1];
+ return url.searchParams.get("docid");
case VideoService.bannedvideo: {
return url.searchParams.get("id");
}

0 comments on commit 13999a7

Please sign in to comment.