rename to parseInputUrl

This commit is contained in:
mrjvs
2023-12-23 23:41:36 +01:00
parent af6ede4a39
commit b89602b87e
3 changed files with 6 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ export interface FebboxFileList {
is_dir: 0 | 1; is_dir: 0 | 1;
} }
export function parseInput(url: string) { export function parseInputUrl(url: string) {
const [type, id, seasonId, episodeId] = url.slice(1).split('/'); const [type, id, seasonId, episodeId] = url.slice(1).split('/');
const season = seasonId ? parseInt(seasonId, 10) : undefined; const season = seasonId ? parseInt(seasonId, 10) : undefined;
const episode = episodeId ? parseInt(episodeId, 10) : undefined; const episode = episodeId ? parseInt(episodeId, 10) : undefined;

View File

@@ -1,7 +1,7 @@
import { MediaTypes } from '@/main/media'; import { MediaTypes } from '@/main/media';
import { flags } from '@/main/targets'; import { flags } from '@/main/targets';
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { parseInput } from '@/providers/embeds/febbox/common'; import { parseInputUrl } from '@/providers/embeds/febbox/common';
import { getStreams } from '@/providers/embeds/febbox/fileList'; import { getStreams } from '@/providers/embeds/febbox/fileList';
import { getSubtitles } from '@/providers/embeds/febbox/subtitles'; import { getSubtitles } from '@/providers/embeds/febbox/subtitles';
import { showboxBase } from '@/providers/sources/showbox/common'; import { showboxBase } from '@/providers/sources/showbox/common';
@@ -17,7 +17,7 @@ export const febboxHlsScraper = makeEmbed({
name: 'Febbox (HLS)', name: 'Febbox (HLS)',
rank: 160, rank: 160,
async scrape(ctx) { async scrape(ctx) {
const { type, id, season, episode } = parseInput(ctx.url); const { type, id, season, episode } = parseInputUrl(ctx.url);
const sharelinkResult = await ctx.proxiedFetcher<{ const sharelinkResult = await ctx.proxiedFetcher<{
data?: { link?: string }; data?: { link?: string };
}>('/index/share_link', { }>('/index/share_link', {

View File

@@ -1,6 +1,6 @@
import { MediaTypes } from '@/main/media';
import { flags } from '@/main/targets'; import { flags } from '@/main/targets';
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { parseInputUrl } from '@/providers/embeds/febbox/common';
import { getStreamQualities } from '@/providers/embeds/febbox/qualities'; import { getStreamQualities } from '@/providers/embeds/febbox/qualities';
import { getSubtitles } from '@/providers/embeds/febbox/subtitles'; import { getSubtitles } from '@/providers/embeds/febbox/subtitles';
@@ -9,9 +9,7 @@ export const febboxMp4Scraper = makeEmbed({
name: 'Febbox (MP4)', name: 'Febbox (MP4)',
rank: 190, rank: 190,
async scrape(ctx) { async scrape(ctx) {
const [type, id, seasonId, episodeId] = ctx.url.slice(1).split('/'); const { type, id, season, episode } = parseInputUrl(ctx.url);
const season = seasonId ? parseInt(seasonId, 10) : undefined;
const episode = episodeId ? parseInt(episodeId, 10) : undefined;
let apiQuery: object | null = null; let apiQuery: object | null = null;
if (type === 'movie') { if (type === 'movie') {
@@ -42,7 +40,7 @@ export const febboxMp4Scraper = makeEmbed({
return { return {
stream: { stream: {
captions: await getSubtitles(ctx, id, fid, type as MediaTypes, episode, season), captions: await getSubtitles(ctx, id, fid, type, episode, season),
qualities, qualities,
type: 'file', type: 'file',
flags: [flags.NO_CORS], flags: [flags.NO_CORS],