mirror of
https://github.com/p-stream/providers.git
synced 2026-04-21 19:22:19 +00:00
fix rgshows
This commit is contained in:
parent
2dfacab40c
commit
f368538694
1 changed files with 15 additions and 3 deletions
|
|
@ -1,14 +1,15 @@
|
||||||
import { flags } from '@/entrypoint/utils/targets';
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||||
import { NotFoundError } from '@/utils/errors';
|
import { NotFoundError } from '@/utils/errors';
|
||||||
import { createM3U8ProxyUrl } from '@/utils/proxy';
|
|
||||||
|
|
||||||
import { SourcererOutput, makeSourcerer } from '../base';
|
import { SourcererOutput, makeSourcerer } from '../base';
|
||||||
|
|
||||||
const baseUrl = 'api.rgshows.me';
|
const baseUrl = 'api.rgshows.me';
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
referer: 'https://rgshows.me/',
|
referer: 'https://rgshows.me/',
|
||||||
origin: 'https://rgshows.me',
|
origin: 'https://rgshows.me',
|
||||||
|
host: baseUrl,
|
||||||
'User-Agent':
|
'User-Agent':
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
|
||||||
};
|
};
|
||||||
|
|
@ -23,10 +24,20 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await ctx.proxiedFetcher(url, { headers });
|
const res = await ctx.proxiedFetcher(url, { headers });
|
||||||
if (!res.stream.url) {
|
if (!res?.stream?.url) {
|
||||||
throw new NotFoundError('No streams found');
|
throw new NotFoundError('No streams found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const streamUrl = res.stream.url;
|
||||||
|
const streamHost = new URL(streamUrl).host;
|
||||||
|
|
||||||
|
const m3u8Headers = {
|
||||||
|
...headers,
|
||||||
|
host: streamHost,
|
||||||
|
origin: 'https://www.rgshows.me',
|
||||||
|
referer: 'https://www.rgshows.me/',
|
||||||
|
};
|
||||||
|
|
||||||
ctx.progress(100);
|
ctx.progress(100);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -35,7 +46,8 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
||||||
{
|
{
|
||||||
id: 'primary',
|
id: 'primary',
|
||||||
type: 'hls',
|
type: 'hls',
|
||||||
playlist: createM3U8ProxyUrl(res.stream.url, headers),
|
playlist: streamUrl,
|
||||||
|
headers: m3u8Headers,
|
||||||
flags: [flags.CORS_ALLOWED],
|
flags: [flags.CORS_ALLOWED],
|
||||||
captions: [],
|
captions: [],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue