fix: subtitle
This commit is contained in:
@@ -134,17 +134,18 @@ class YouTubeCaptionProvider {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const baseUrl = new URL(captionTrack.baseUrl);
|
const baseUrl = new URL(captionTrack.baseUrl);
|
||||||
baseUrl.searchParams.set("potc", potUrl.searchParams.get("potc"));
|
potUrl.searchParams.set("lang", baseUrl.searchParams.get("lang"));
|
||||||
baseUrl.searchParams.set("pot", potUrl.searchParams.get("pot"));
|
potUrl.searchParams.set("fmt", "json3");
|
||||||
baseUrl.searchParams.set("fmt", "json3");
|
if (baseUrl.searchParams.get("kind")) {
|
||||||
baseUrl.searchParams.set("c", potUrl.searchParams.get("c"));
|
potUrl.searchParams.set("kind", baseUrl.searchParams.get("kind"));
|
||||||
if (potUrl.searchParams.get("kind")) {
|
} else {
|
||||||
baseUrl.searchParams.set("kind", potUrl.searchParams.get("kind"));
|
potUrl.searchParams.delete("kind");
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(baseUrl);
|
const res = await fetch(potUrl);
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
return res.json();
|
const json = await res.json();
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
logger.error(
|
logger.error(
|
||||||
`Youtube Provider: Failed to fetch subtitles: ${res.status}`
|
`Youtube Provider: Failed to fetch subtitles: ${res.status}`
|
||||||
|
|||||||
Reference in New Issue
Block a user