fix(extractor): use correct referer for rgshows, treat vidzee response as block
This commit is contained in:
parent
7c99e4d1c1
commit
d259587491
3 changed files with 16 additions and 12 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { Context, Format, Meta, UrlResult } from '../types';
|
||||
import { BlockedError } from '../error';
|
||||
import { BlockedReason, Context, Format, Meta, UrlResult } from '../types';
|
||||
import { guessHeightFromPlaylist } from '../utils';
|
||||
import { Extractor } from './Extractor';
|
||||
|
||||
|
|
@ -20,13 +21,16 @@ export class RgShows extends Extractor {
|
|||
}
|
||||
|
||||
protected async extractInternal(ctx: Context, url: URL, meta: Meta): Promise<UrlResult[]> {
|
||||
const nonSubDomainUrl = new URL(url);
|
||||
nonSubDomainUrl.hostname = nonSubDomainUrl.hostname.split('.').slice(-2).join('.');
|
||||
const headers = { 'Referer': `${nonSubDomainUrl.origin}/`, 'Origin': nonSubDomainUrl.origin, 'User-Agent': 'Mozilla' };
|
||||
const headers = { 'Referer': 'https://www.rgshows.ru/', 'Origin': 'https://www.rgshows.ru', 'User-Agent': 'Mozilla' };
|
||||
|
||||
const data = await this.fetcher.json(ctx, url, { headers }) as RgShowsApiData;
|
||||
|
||||
const streamUrl = new URL(data.stream.url);
|
||||
/* istanbul ignore if */
|
||||
if (streamUrl.host.includes('vidzee')) {
|
||||
throw new BlockedError(url, BlockedReason.unknown, {});
|
||||
}
|
||||
|
||||
const isMp4 = streamUrl.href.includes('mp4');
|
||||
const isHls = streamUrl.href.includes('m3u8') || streamUrl.href.includes('txt');
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ exports[`RgShows handle one battle after another 1`] = `
|
|||
"height": 1080,
|
||||
},
|
||||
"requestHeaders": {
|
||||
"Origin": "https://rgshows.ru",
|
||||
"Referer": "https://rgshows.ru/",
|
||||
"Origin": "https://www.rgshows.ru",
|
||||
"Referer": "https://www.rgshows.ru/",
|
||||
"User-Agent": "Mozilla",
|
||||
},
|
||||
"ttl": 10800000,
|
||||
|
|
@ -29,8 +29,8 @@ exports[`RgShows handle parasite 2019 (mp4) 1`] = `
|
|||
"extractorId": "rgshows",
|
||||
},
|
||||
"requestHeaders": {
|
||||
"Origin": "https://rgshows.ru",
|
||||
"Referer": "https://rgshows.ru/",
|
||||
"Origin": "https://www.rgshows.ru",
|
||||
"Referer": "https://www.rgshows.ru/",
|
||||
"User-Agent": "Mozilla",
|
||||
},
|
||||
"ttl": 10800000,
|
||||
|
|
@ -49,8 +49,8 @@ exports[`RgShows handle stranger things s05e01 1`] = `
|
|||
"height": 1080,
|
||||
},
|
||||
"requestHeaders": {
|
||||
"Origin": "https://rgshows.ru",
|
||||
"Referer": "https://rgshows.ru/",
|
||||
"Origin": "https://www.rgshows.ru",
|
||||
"Referer": "https://www.rgshows.ru/",
|
||||
"User-Agent": "Mozilla",
|
||||
},
|
||||
"ttl": 10800000,
|
||||
|
|
|
|||
|
|
@ -551,8 +551,8 @@ exports[`resolve uses priority for sorting 1`] = `
|
|||
"notWebReady": true,
|
||||
"proxyHeaders": {
|
||||
"request": {
|
||||
"Origin": "https://rgshows.ru",
|
||||
"Referer": "https://rgshows.ru/",
|
||||
"Origin": "https://www.rgshows.ru",
|
||||
"Referer": "https://www.rgshows.ru/",
|
||||
"User-Agent": "Mozilla",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue