mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 14:53:24 +00:00
6
.docs/package-lock.json
generated
6
.docs/package-lock.json
generated
@@ -17286,9 +17286,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz",
|
||||||
"integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==",
|
"integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.18.10",
|
"esbuild": "^0.18.10",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@movie-web/providers",
|
"name": "@movie-web/providers",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"description": "Package that contains all the providers of movie-web",
|
"description": "Package that contains all the providers of movie-web",
|
||||||
"main": "./lib/index.umd.js",
|
"main": "./lib/index.umd.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
|
@@ -11,3 +11,4 @@ export const apiUrls = [
|
|||||||
];
|
];
|
||||||
export const appKey = atob('bW92aWVib3g=');
|
export const appKey = atob('bW92aWVib3g=');
|
||||||
export const appId = atob('Y29tLnRkby5zaG93Ym94');
|
export const appId = atob('Y29tLnRkby5zaG93Ym94');
|
||||||
|
export const captionsDomains = [atob('bWJwaW1hZ2VzLmNodWF4aW4uY29t'), atob('aW1hZ2VzLnNoZWd1Lm5ldA==')];
|
||||||
|
@@ -2,6 +2,8 @@ import { Caption, getCaptionTypeFromUrl, isValidLanguageCode } from '@/providers
|
|||||||
import { sendRequest } from '@/providers/sources/superstream/sendRequest';
|
import { sendRequest } from '@/providers/sources/superstream/sendRequest';
|
||||||
import { ScrapeContext } from '@/utils/context';
|
import { ScrapeContext } from '@/utils/context';
|
||||||
|
|
||||||
|
import { captionsDomains } from './common';
|
||||||
|
|
||||||
interface CaptionApiResponse {
|
interface CaptionApiResponse {
|
||||||
data: {
|
data: {
|
||||||
list: {
|
list: {
|
||||||
@@ -40,7 +42,13 @@ export async function getSubtitles(
|
|||||||
subtitleList.forEach((sub) => {
|
subtitleList.forEach((sub) => {
|
||||||
const subtitle = sub.subtitles.sort((a, b) => b.order - a.order)[0];
|
const subtitle = sub.subtitles.sort((a, b) => b.order - a.order)[0];
|
||||||
if (!subtitle) return;
|
if (!subtitle) return;
|
||||||
const subtitleType = getCaptionTypeFromUrl(subtitle.file_path);
|
const subtitleFilePath = subtitle.file_path
|
||||||
|
.replace(captionsDomains[0], captionsDomains[1])
|
||||||
|
.replace(/\s/g, '+')
|
||||||
|
.replace(/[()]/g, (c) => {
|
||||||
|
return `%${c.charCodeAt(0).toString(16)}`;
|
||||||
|
});
|
||||||
|
const subtitleType = getCaptionTypeFromUrl(subtitleFilePath);
|
||||||
if (!subtitleType) return;
|
if (!subtitleType) return;
|
||||||
|
|
||||||
const validCode = isValidLanguageCode(subtitle.lang);
|
const validCode = isValidLanguageCode(subtitle.lang);
|
||||||
@@ -50,7 +58,7 @@ export async function getSubtitles(
|
|||||||
language: subtitle.lang,
|
language: subtitle.lang,
|
||||||
hasCorsRestrictions: true,
|
hasCorsRestrictions: true,
|
||||||
type: subtitleType,
|
type: subtitleType,
|
||||||
url: subtitle.file_path,
|
url: subtitleFilePath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user