fix(extractor): support non-HLS streams in RgShows
This commit is contained in:
parent
5cb4944413
commit
d1fcd671c9
4 changed files with 31 additions and 4 deletions
|
|
@ -17,4 +17,8 @@ describe('RgShows', () => {
|
|||
test('handle stranger things s05e01', async () => {
|
||||
expect(await extractorRegistry.handle(ctx, new URL('https://api.rgshows.ru/main/tv/66732/5/1'))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('handle parasite 2019 (mp4)', async () => {
|
||||
expect(await extractorRegistry.handle(ctx, new URL('https://api.rgshows.ru/main/movie/496243'))).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,17 +26,19 @@ export class RgShows extends Extractor {
|
|||
|
||||
const data = await this.fetcher.json(ctx, url, { headers }) as RgShowsApiData;
|
||||
|
||||
const playlistUrl = new URL(data.stream.url);
|
||||
const streamUrl = new URL(data.stream.url);
|
||||
const isMp4 = streamUrl.href.includes('mp4');
|
||||
const isHls = streamUrl.href.includes('m3u8') || streamUrl.href.includes('txt');
|
||||
|
||||
return [
|
||||
{
|
||||
url: playlistUrl,
|
||||
format: Format.hls,
|
||||
url: streamUrl,
|
||||
format: isMp4 ? Format.mp4 : (isHls ? Format.hls : /* istanbul ignore next */ Format.unknown),
|
||||
label: this.label,
|
||||
ttl: this.ttl,
|
||||
meta: {
|
||||
...meta,
|
||||
height: await guessHeightFromPlaylist(ctx, this.fetcher, playlistUrl, url, { headers }),
|
||||
...(isHls && { height: await guessHeightFromPlaylist(ctx, this.fetcher, streamUrl, url, { headers }) }),
|
||||
},
|
||||
requestHeaders: headers,
|
||||
},
|
||||
|
|
|
|||
1
src/extractor/__fixtures__/RgShows/https:api.rgshows.rumainmovie496243
generated
Normal file
1
src/extractor/__fixtures__/RgShows/https:api.rgshows.rumainmovie496243
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"stream":{"url":"https://khdiamondcdn.asia/gs/87EU555O0I0056A?q=.mp4"}}
|
||||
|
|
@ -21,6 +21,26 @@ exports[`RgShows handle one battle after another 1`] = `
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`RgShows handle parasite 2019 (mp4) 1`] = `
|
||||
[
|
||||
{
|
||||
"format": "mp4",
|
||||
"label": "RgShows",
|
||||
"meta": {
|
||||
"countryCodes": [],
|
||||
"extractorId": "rgshows",
|
||||
},
|
||||
"requestHeaders": {
|
||||
"Origin": "https://rgshows.ru",
|
||||
"Referer": "https://rgshows.ru/",
|
||||
"User-Agent": "Mozilla",
|
||||
},
|
||||
"ttl": 10800000,
|
||||
"url": "https://khdiamondcdn.asia/gs/87EU555O0I0056A?q=.mp4",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`RgShows handle stranger things s05e01 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue