fix(extractor): use correct referer for rgshows, treat vidzee response as block

This commit is contained in:
WebStreamr 2026-01-19 09:12:45 +00:00
parent 7c99e4d1c1
commit d259587491
No known key found for this signature in database
3 changed files with 16 additions and 12 deletions

View file

@ -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 { guessHeightFromPlaylist } from '../utils';
import { Extractor } from './Extractor'; import { Extractor } from './Extractor';
@ -20,13 +21,16 @@ export class RgShows extends Extractor {
} }
protected async extractInternal(ctx: Context, url: URL, meta: Meta): Promise<UrlResult[]> { protected async extractInternal(ctx: Context, url: URL, meta: Meta): Promise<UrlResult[]> {
const nonSubDomainUrl = new URL(url); const headers = { 'Referer': 'https://www.rgshows.ru/', 'Origin': 'https://www.rgshows.ru', 'User-Agent': 'Mozilla' };
nonSubDomainUrl.hostname = nonSubDomainUrl.hostname.split('.').slice(-2).join('.');
const headers = { 'Referer': `${nonSubDomainUrl.origin}/`, 'Origin': nonSubDomainUrl.origin, 'User-Agent': 'Mozilla' };
const data = await this.fetcher.json(ctx, url, { headers }) as RgShowsApiData; const data = await this.fetcher.json(ctx, url, { headers }) as RgShowsApiData;
const streamUrl = new URL(data.stream.url); 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 isMp4 = streamUrl.href.includes('mp4');
const isHls = streamUrl.href.includes('m3u8') || streamUrl.href.includes('txt'); const isHls = streamUrl.href.includes('m3u8') || streamUrl.href.includes('txt');

View file

@ -10,8 +10,8 @@ exports[`RgShows handle one battle after another 1`] = `
"height": 1080, "height": 1080,
}, },
"requestHeaders": { "requestHeaders": {
"Origin": "https://rgshows.ru", "Origin": "https://www.rgshows.ru",
"Referer": "https://rgshows.ru/", "Referer": "https://www.rgshows.ru/",
"User-Agent": "Mozilla", "User-Agent": "Mozilla",
}, },
"ttl": 10800000, "ttl": 10800000,
@ -29,8 +29,8 @@ exports[`RgShows handle parasite 2019 (mp4) 1`] = `
"extractorId": "rgshows", "extractorId": "rgshows",
}, },
"requestHeaders": { "requestHeaders": {
"Origin": "https://rgshows.ru", "Origin": "https://www.rgshows.ru",
"Referer": "https://rgshows.ru/", "Referer": "https://www.rgshows.ru/",
"User-Agent": "Mozilla", "User-Agent": "Mozilla",
}, },
"ttl": 10800000, "ttl": 10800000,
@ -49,8 +49,8 @@ exports[`RgShows handle stranger things s05e01 1`] = `
"height": 1080, "height": 1080,
}, },
"requestHeaders": { "requestHeaders": {
"Origin": "https://rgshows.ru", "Origin": "https://www.rgshows.ru",
"Referer": "https://rgshows.ru/", "Referer": "https://www.rgshows.ru/",
"User-Agent": "Mozilla", "User-Agent": "Mozilla",
}, },
"ttl": 10800000, "ttl": 10800000,

View file

@ -551,8 +551,8 @@ exports[`resolve uses priority for sorting 1`] = `
"notWebReady": true, "notWebReady": true,
"proxyHeaders": { "proxyHeaders": {
"request": { "request": {
"Origin": "https://rgshows.ru", "Origin": "https://www.rgshows.ru",
"Referer": "https://rgshows.ru/", "Referer": "https://www.rgshows.ru/",
"User-Agent": "Mozilla", "User-Agent": "Mozilla",
}, },
}, },