mirror of
https://github.com/p-stream/providers.git
synced 2026-04-19 11:42:06 +00:00
update docs
This commit is contained in:
parent
1f98cd3636
commit
bd32939b98
4 changed files with 22 additions and 11 deletions
|
|
@ -368,8 +368,9 @@ return {
|
|||
stream: [{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
playlist: createM3U8ProxyUrl(originalPlaylist, streamHeaders),
|
||||
flags: [flags.CORS_ALLOWED], // Proxy bypasses cors so we say it's allowed
|
||||
playlist: createM3U8ProxyUrl(originalPlaylist, ctx.features, streamHeaders),
|
||||
headers: streamHeaders, // Include headers in the createM3U8ProxyUrl function and here for native and extension targets
|
||||
flags: [flags.CORS_ALLOWED], // createM3U8ProxyUrl (or the extension) bypasses cors so we say it's allowed to play in a browser
|
||||
captions: []
|
||||
}]
|
||||
};
|
||||
|
|
@ -390,7 +391,7 @@ return {
|
|||
type: 'hls',
|
||||
playlist: originalPlaylist,
|
||||
headers: streamHeaders,
|
||||
flags: [], // Use the extension becuase it can pass headers
|
||||
flags: [], // Use the extension becuase it can pass headers, include no flag for extension or native
|
||||
captions: []
|
||||
}]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ async scrape(ctx) {
|
|||
stream: [{
|
||||
type: 'hls',
|
||||
id: 'primary',
|
||||
playlist: createM3U8ProxyUrl(playlist, streamHeaders),
|
||||
playlist: createM3U8ProxyUrl(playlist, ctx.features, streamHeaders),
|
||||
headers: streamHeaders,
|
||||
flags: [], captions: []
|
||||
}]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -85,8 +85,9 @@ return {
|
|||
stream: [{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
playlist: createM3U8ProxyUrl(originalUrl, headers),
|
||||
flags: [], // No flags = extension/native only
|
||||
playlist: createM3U8ProxyUrl(originalUrl, ctx.features, headers),
|
||||
headers,
|
||||
flags: [], // No flags = extension/native only, but this case doesn't make sense because the stream is getting proxied.
|
||||
captions: []
|
||||
}]
|
||||
};
|
||||
|
|
@ -96,7 +97,8 @@ return {
|
|||
stream: [{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
playlist: createM3U8ProxyUrl(originalUrl, headers),
|
||||
playlist: createM3U8ProxyUrl(originalUrl, ctx.features, headers),
|
||||
headers, // again listing headers twice so the extension can use them.
|
||||
flags: [flags.CORS_ALLOWED], // Works across all targets
|
||||
captions: []
|
||||
}]
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ return {
|
|||
|
||||
Using the createM3U8ProxyUrl function we can use our configured M3U8 proxy to send headers to the playlist and all it's segments.
|
||||
|
||||
**When the target is browser-extension or native, then the createM3U8ProxyUrl function will return an unproxied url. It ONLY converts for vanilla browser targets to bypass CORS.** This is why you need to also include the headers item in the stream response rather than in just the function.
|
||||
|
||||
```typescript
|
||||
import { createM3U8ProxyUrl } from '@/utils/proxy';
|
||||
|
||||
|
|
@ -87,14 +89,12 @@ const streamHeaders = {
|
|||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
|
||||
};
|
||||
|
||||
// Create proxied URL that handles headers and CORS
|
||||
const proxiedUrl = createM3U8ProxyUrl(originalPlaylist, streamHeaders);
|
||||
|
||||
return {
|
||||
stream: [{
|
||||
id: 'primary',
|
||||
type: 'hls',
|
||||
playlist: proxiedUrl, // Use proxied URL
|
||||
playlist: createM3U8ProxyUrl(originalPlaylist, ctx.features, streamHeaders), // Include headers for proxy usage
|
||||
headers: streamHeaders, // Include headers for extension/native usage
|
||||
flags: [flags.CORS_ALLOWED], // Proxy enables CORS for all targets
|
||||
captions: []
|
||||
}]
|
||||
|
|
@ -111,6 +111,13 @@ const SKIP_VALIDATION_CHECK_IDS = [
|
|||
// ... existing IDs
|
||||
'your-scraper-id', // Add your scraper ID here
|
||||
];
|
||||
|
||||
// Sources here are always proxied, so we dont need to validate with a proxy, but we should fetch nativly
|
||||
// NOTE: all m3u8 proxy urls are automatically processed using this method, so no need to add them here manually
|
||||
const UNPROXIED_VALIDATION_CHECK_IDS = [
|
||||
// ... existing IDs
|
||||
'your-scraper-id', // Add your scraper ID here
|
||||
];
|
||||
```
|
||||
|
||||
**Why this is needed:**
|
||||
|
|
|
|||
Loading…
Reference in a new issue