add upcloud captions
This commit is contained in:
parent
4ce41e828d
commit
fe4882b43e
|
@ -2,6 +2,7 @@ import crypto from 'crypto-js';
|
||||||
|
|
||||||
import { flags } from '@/main/targets';
|
import { flags } from '@/main/targets';
|
||||||
import { makeEmbed } from '@/providers/base';
|
import { makeEmbed } from '@/providers/base';
|
||||||
|
import { Caption, getCaptionTypeFromUrl } from '@/providers/captions';
|
||||||
|
|
||||||
const { AES, enc } = crypto;
|
const { AES, enc } = crypto;
|
||||||
|
|
||||||
|
@ -96,12 +97,25 @@ export const upcloudScraper = makeEmbed({
|
||||||
|
|
||||||
if (!sources) throw new Error('upcloud source not found');
|
if (!sources) throw new Error('upcloud source not found');
|
||||||
|
|
||||||
|
const captions: Caption[] = [];
|
||||||
|
streamRes.tracks.forEach((track) => {
|
||||||
|
if (track.kind !== 'captions') return;
|
||||||
|
const type = getCaptionTypeFromUrl(track.file);
|
||||||
|
if (!type) return;
|
||||||
|
captions.push({
|
||||||
|
language: track.label, // TODO Turn language name into ISO code
|
||||||
|
hasCorsRestrictions: false,
|
||||||
|
type,
|
||||||
|
url: track.file,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stream: {
|
stream: {
|
||||||
type: 'hls',
|
type: 'hls',
|
||||||
playlist: sources.file,
|
playlist: sources.file,
|
||||||
flags: [flags.NO_CORS],
|
flags: [flags.NO_CORS],
|
||||||
captions: [],
|
captions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,9 +17,7 @@ export const goMoviesScraper = makeSourcerer({
|
||||||
async scrapeShow(ctx) {
|
async scrapeShow(ctx) {
|
||||||
const search = await ctx.proxiedFetcher<string>(`/ajax/search`, {
|
const search = await ctx.proxiedFetcher<string>(`/ajax/search`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: new URLSearchParams({ keyword: ctx.media.title }),
|
||||||
keyword: ctx.media.title,
|
|
||||||
}),
|
|
||||||
headers: {
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
|
@ -104,9 +102,7 @@ export const goMoviesScraper = makeSourcerer({
|
||||||
async scrapeMovie(ctx) {
|
async scrapeMovie(ctx) {
|
||||||
const search = await ctx.proxiedFetcher<string>(`ajax/search`, {
|
const search = await ctx.proxiedFetcher<string>(`ajax/search`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: new URLSearchParams({ keyword: ctx.media.title }),
|
||||||
keyword: ctx.media.title,
|
|
||||||
}),
|
|
||||||
headers: {
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue