Skip to content

Commit

Permalink
fix youtube subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Mar 20, 2024
1 parent 506361f commit 6c6cd79
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 838 deletions.
855 changes: 26 additions & 829 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@
"webpack-merge": "^5.7.3"
},
"dependencies": {
"@mswjs/interceptors": "^0.25.16",
"@mswjs/interceptors": "^0.26.8",
"async-wait-until": "^2.0.12",
"bcp-47": "^2.0.0",
"bootstrap": "^4.5.3",
"cheerio": "^1.0.0-rc.12",
"crypto-browserify": "^3.12.0",
"crypto-js": "^4.2.0",
"delay": "^6.0.0",
"franc": "^6.2.0",
Expand All @@ -57,7 +56,6 @@
"memoizee": "^0.4.15",
"pinia": "^2.1.7",
"source-map-support": "^0.5.21",
"stream-browserify": "^3.0.0",
"tesseract.js": "^5.0.3",
"textfit": "^2.4.0",
"throttle-debounce": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { enableMouseoverTextEvent } from "/src/event/mouseover";
import * as util from "/src/util";
import * as ocrView from "/src/ocr/ocrView.js";
import subtitle from "/src/subtitle";
import subtitle from "/src/subtitle/subtitle.js";
import { langListOpposite } from "/src/util/lang.js";

//init environment var======================================================================\
Expand Down
7 changes: 5 additions & 2 deletions src/subtitle/baseVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { XMLHttpRequestInterceptor } from "@mswjs/interceptors/XMLHttpRequest";
import { debounce } from "throttle-debounce";
import $ from "jquery";
import memoize from "memoizee";
import browser from "webextension-polyfill";
import { waitUntil, WAIT_FOREVER } from "async-wait-until";
var browser;
try {
browser = require("webextension-polyfill");
} catch (error) {}

export default class BaseVideo {
static sitePattern = /^(https:\/\/)(example\.com)/;
Expand Down Expand Up @@ -231,7 +234,7 @@ export default class BaseVideo {
tlang,
videoId
) {
return await this.requestSubtitle(subUrl, lang, tlang, videoId);
return await this.requestSubtitle(...arguments);
});

//util =======================
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/subtitle/youtube.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import $ from "jquery";
import memoize from "memoizee";

import BaseVideo from "./baseVideo";
import * as util from "/src/util";

Expand Down
6 changes: 5 additions & 1 deletion src/util/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import $ from "jquery";
import isUrl from "is-url";
import _ from "lodash";
import browser from "webextension-polyfill";
import { iso6393To1 } from "iso-639-3";
import { francAll } from "franc";
import { parse } from "bcp-47";
import { waitUntil, WAIT_FOREVER } from "async-wait-until";
var browser;
try {
browser = require("webextension-polyfill");
} catch (error) {}

import { Setting } from "./setting.js";

import {
Expand Down
6 changes: 5 additions & 1 deletion src/util/setting.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import browser from "webextension-polyfill";
// import browser from "webextension-polyfill";
var browser;
try {
browser = require("webextension-polyfill");
} catch (error) {}

// load setting from chrome storage
// automatic setting update class===============================
Expand Down

0 comments on commit 6c6cd79

Please sign in to comment.