Skip to content

Commit 9714ad5

Browse files
author
Inside4ndroid
committed
docs: update README and CHANGELOG for v1.0.6 proxy features
1 parent 17079e1 commit 9714ad5

7 files changed

Lines changed: 133 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.6] - 2025-09-20
6+
7+
### Removed
8+
- MoviesClub provider (multi-server scraping complexities & Turnstile challenge; deprecated permanently)
9+
- Xprime provider (upstream Xprime.tv offline due to security changes)
10+
- 4khdhub provider: all `.zip` archive links are now omitted entirely (previous releases experimented with stripping the extension which produced non‑playable pseudo‑MKV links)
11+
12+
### Added
13+
- Structured multi-server debug instrumentation (session summaries, per-fetch metrics, pattern counters)
14+
- Turnstile challenge detection & bypass attempt scaffold (synthetic `/rcp_verify` token posting)
15+
- Optional internal stream proxy (`enableProxy` flag): mounts `/m3u8-proxy`, `/ts-proxy`, `/sub-proxy` with playlist + segment + subtitle handling and segment prefetch cache.
16+
- Proxy range management features:
17+
- `clampOpen` (default on) – caps ambiguous open‑ended `bytes=0-` requests to a bounded initial window (`openChunkKB`, default 4096 KB)
18+
- `progressiveOpen` (default on) – incremental expansion of the head range on successive `bytes=0-` requests instead of a single huge span
19+
- `initChunkKB` (default 512 KB) – size of the synthetic initial 206 response when neither clamp/progressive produce a range and `noSynth` is not set
20+
- `tailPrefetch` (default on) + `tailPrefetchKB` (default 256 KB) – asynchronous fetch & in‑memory cache of the file tail to satisfy rapid VLC tail probes
21+
- `force200` (opt‑in) – normalizes upstream 206 responses to 200 for diagnostics
22+
- `noSynth` (opt‑in) – disables synthetic initial partial response generation
23+
- Tail prefetch TTL cleanup task (30 min window) and in‑memory maps for: segment cache, open range clamp, progressive growth, and tail buffers
24+
- Host routing overrides: `pixeldrain.*` & `video-downloads.googleusercontent.com` are forced through `/ts-proxy` (extensionless or ambiguous content)
25+
26+
### Changed
27+
- Centralized multi-server request headers with realistic `sec-ch-ua*` & `Sec-Fetch-*` values
28+
- Added retry, rotating User-Agent, and cookie jar logic to multi-server fetch pipeline
29+
- Showbox provider priority map updated after Xprime removal
30+
- README/Docs trimmed to reflect current active providers only
31+
- When `enableProxy` is active, stream response objects have their original `headers` field removed (proxy handles all required headers internally).
32+
- 4khdhub provider now filters out archive endpoints instead of attempting extension normalization (prevents feeding ZIP files to players)
33+
- Open‑ended range handling improved to reduce VLC negotiation loops by throttling first‑pass read size and growing progressively
34+
- Synthetic initial partial response is automatically suppressed when `progressiveOpen` is active (real range growth preferred)
35+
36+
### Fixed
37+
- Ensured multi-server fallback attempts (direct rcp player/m3u8 extraction) operate with improved diagnostics
38+
- Eliminated repeated VLC tail probe stalls caused by archive masquerading as video content (root cause was filtered by dropping `.zip` URLs)
39+
40+
### Documentation
41+
- Updated README version badge to 1.0.6 and provider list (removed MoviesClub & Xprime, clarified active providers list)
42+
- Added proxy tuning parameter reference (clamp/progressive/tail prefetch, synthetic partial, force200) and host override notes
43+
- Expanded explanation that per‑stream headers are stripped when proxying is enabled
44+
45+
546
## [1.0.5] - 2025-09-19
647

748
### Improved
@@ -10,13 +51,11 @@ All notable changes to this project will be documented in this file.
1051
- Tightened URL validation: removed unconditional trust for `r2.dev`; validation logic now consistent across hosts.
1152
- Host distribution instrumentation logs final hostname counts for easier diagnostics.
1253
- Preserved HubCloud worker `.zip` links by stripping the `.zip` extension instead of discarding them (enables direct playback attempts).
13-
- MoviesClub provider: Added automatic `Origin`/`Referer` headers for `vidora.stream` sources to prevent 403 responses.
1454

1555
### Notes
1656
- `r2.dev` links are always removed from final output; no env flag required.
1757

1858
### Documentation
19-
- README: Updated Providers section, unified schema example, MoviesClub listed, registry mapping instructions, and badge version.
2059

2160
## [1.0.4] - 2025-09-18
2261

@@ -70,6 +109,8 @@ All notable changes to this project will be documented in this file.
70109
## [1.0.0] - 2025-09-16
71110
- Initial stable release.
72111

112+
[1.0.6]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.5...v1.0.6
113+
[1.0.5]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.4...v1.0.5
73114
[1.0.3]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.2...v1.0.3
74115
[1.0.4]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.3...v1.0.4
75116
[1.0.2]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.1...v1.0.2

README.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<img src="https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat" />
77
<img src="https://img.shields.io/badge/Status-Active-success?style=flat" />
88
<img src="https://img.shields.io/badge/License-MIT-blue?style=flat" />
9-
<img src="https://img.shields.io/badge/Version-1.0.5-informational?style=flat" />
9+
<img src="https://img.shields.io/badge/Version-1.0.6-informational?style=flat" />
1010
<img src="https://img.shields.io/docker/pulls/inside4ndroid/tmdb-embed-api?label=Docker%20Pulls&style=flat" />
1111
</p>
1212

@@ -34,7 +34,7 @@
3434

3535
## ✨ Features
3636
- **Multi‑TMDB Key Rotation** – Supply multiple API keys; one is chosen randomly per request.
37-
- **Provider Aggregation** – Pluggable providers (Showbox, 4khdhub, MoviesMod, MP4Hydra, VidZee, Vixsrc, Xprime, MoviesClub) with per‑provider enable toggles + default selection.
37+
- **Provider Aggregation** – Pluggable providers (Showbox, 4khdhub, MoviesMod, MP4Hydra, VidZee, Vixsrc, UHDMovies) with per‑provider enable toggles + default selection.
3838
- **🔥 Plugin System** – Drop new provider files in `providers/` and add its exported function to the registry map (`providers/registry.js``providerFunctionMap`).
3939
- **Dynamic Filtering** – Minimum quality presets, custom JSON quality map, codec exclusion rules (presets + JSON).
4040
- **Runtime Overrides UI** – Fully interactive web admin at `/` (login protected) writing to `utils/user-config.json`.
@@ -43,6 +43,23 @@
4343
- **Config Propagation** – Overrides mirrored to `process.env` for legacy compatibility (no `.env` required after first save).
4444
- **Back‑Navigation Safe** – Cache-control + visibility/session revalidation.
4545
- **Extensible** – Simple drop-in provider plugin system.
46+
- **Optional Stream Proxy Layer** – When enabled, rewrites returned stream URLs so HLS playlists, TS segments, and subtitles are served through internal endpoints (`/m3u8-proxy`, `/ts-proxy`, `/sub-proxy`) allowing uniform headers, origin shielding, and optional segment caching.
47+
When active the API omits per-stream `headers` objects from responses (they're no longer needed by clients) to avoid leaking upstream header requirements.
48+
49+
Proxy Tuning Parameters (query flags accepted by `/ts-proxy` – defaults shown):
50+
- `clampOpen` (on) – If a client sends an ambiguous `Range: bytes=0-`, constrain it to an initial window of `openChunkKB` (default 4096 KB) to avoid huge first reads.
51+
- `openChunkKB=4096` – Size (KB) used for both clamp window and each progressive expansion increment.
52+
- `progressiveOpen` (on) – Grow successive ambiguous head requests (`bytes=0-`) incrementally instead of one large span. Maintains a per‑URL expansion map.
53+
- `initChunkKB=512` – Size used for a synthetic initial partial (206) when no client range is provided and progressive growth is disabled. Capped 64–2048 KB.
54+
- `noSynth=1` – Disable synthetic initial partial generation (forces pass‑through behavior).
55+
- `force200=1` – Normalize upstream 206 responses to 200 (diagnostics / edge player testing).
56+
- `tailPrefetch` (on) – Enable asynchronous tail fetch of the file’s last bytes to satisfy rapid player tail probes.
57+
- `tailPrefetchKB=256` – Tail window size (64–2048 KB). Cached in memory with TTL cleanup.
58+
Behavior Notes:
59+
- Synthetic partials auto‑disable when `progressiveOpen` is active (real progressive ranges preferred).
60+
- Player tail probes (e.g., VLC metadata scans) are accelerated by the cached tail window.
61+
- Forced 200 mode strips `Content-Range` to emulate full responses for troubleshooting.
62+
- Host Overrides: `pixeldrain.*` and `video-downloads.googleusercontent.com` URLs are routed through `/ts-proxy` regardless of extension to ensure correct range + MIME handling.
4663

4764
---
4865

@@ -217,9 +234,8 @@ The API supports a plugin system. Drop a new provider file in the `providers/` f
217234
- `mp4hydra` - MP4Hydra streams
218235
- `vidzee` - VidZee streams
219236
- `vixsrc` - Vixsrc streams
220-
- `xprime` - Xprime streams
221237
- `uhdmovies` - UHD Movies streams
222-
- `moviesclub` - MoviesClub streams
238+
223239

224240
### Adding a New Provider
225241
1. **Create** `providers/yourprovider.js` with your stream fetching logic
@@ -234,9 +250,7 @@ The API supports a plugin system. Drop a new provider file in the `providers/` f
234250
'MP4Hydra.js': 'getMP4HydraStreams',
235251
'VidZee.js': 'getVidZeeStreams',
236252
'vixsrc.js': 'getVixsrcStreams',
237-
'xprime.js': 'getXprimeStreams',
238-
'uhdmovies.js': 'getUHDMoviesStreams',
239-
'moviesclub.js': 'getMoviesClubStreams',
253+
'uhdmovies.js': 'getUHDMoviesStreams',
240254
'yourprovider.js': 'getYourproviderStreams'
241255
};
242256
```
@@ -299,6 +313,21 @@ Aggregate endpoint auto-resolves IMDb when needed and merges provider output bef
299313

300314
Filtering passes through `applyFilters` to enforce min quality + codec exclusions.
301315

316+
> Note: When the `enableProxy` flag is turned on, provider-specific request headers are stripped from each stream object before responding. Clients should use the proxied URL directly without adding custom Referer/Origin headers.
317+
318+
---
319+
320+
## ⚙️ Configuration Flags (Advanced Panel)
321+
| Flag | Default | Purpose |
322+
|------|---------|---------|
323+
| disableCache | false | Disables internal caches (Showbox + proxy segment cache) |
324+
| enablePStreamApi | true | Enables Showbox PStream-specific handling |
325+
| disableUrlValidation | false | Skip general URL pattern validation checks |
326+
| disable4khdhubUrlValidation | false | Skip 4khdhub-specific URL validation |
327+
| enableProxy | false | Mounts proxy routes and rewrites stream URLs through them |
328+
329+
Toggle `enableProxy` to activate the internal proxy. This adds lightweight playlist/segment/subtitle rewriting without modifying provider code. Disable it to return direct upstream URLs.
330+
302331
---
303332

304333
## 🧩 Quality & Codec Filtering

providers/moviesclub.js

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33

44
const axios = require('axios');
55
const JsUnpacker = require('../utils/jsunpack');
6+
const { config } = require('../utils/config');
7+
8+
function applyMoviesClubProxy(url) {
9+
try {
10+
const base = config.moviesclubProxy;
11+
if (!base || typeof base !== 'string') return url;
12+
// Ensure base ends with either = or a delimiter allowing raw append
13+
const proxied = base + encodeURIComponent(url);
14+
return proxied;
15+
} catch {
16+
return url;
17+
}
18+
}
619

720
async function getMoviesClubStreams(tmdbId, mediaType, season, episode) {
821
console.log(`[moviesclub] Fetching streams for ${mediaType} tmdbId=${tmdbId} season=${season} episode=${episode}`);
@@ -52,7 +65,7 @@ async function getMoviesClubStreams(tmdbId, mediaType, season, episode) {
5265
// Check if this is a cdn.moviesapi.club embed URL with multiple servers
5366
if (embedUrl.includes('cdn.moviesapi.club')) {
5467
console.log('[moviesclub] Detected cdn.moviesapi.club embed URL, handling multiple servers');
55-
return await handleMultipleServers(embedUrl, mediaType, season, episode, tmdbId);
68+
return null;
5669
}
5770

5871
// Handle regular embed URLs (existing logic)
@@ -104,11 +117,12 @@ async function handleMultipleServers(embedUrl, mediaType, season, episode, tmdbI
104117

105118
// If it's a URL, use it directly
106119
if (decodedSrc.startsWith('http')) {
120+
const rawUrl = decodedSrc;
107121
const stream = {
108122
name: `MoviesClub - Direct Stream`,
109123
title: `${mediaType === 'movie' ? 'Movie' : `S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`} ${tmdbId} - MoviesClub Direct`,
110-
url: decodedSrc,
111-
quality: extractQualityFromUrl(decodedSrc) || '720p'
124+
url: applyMoviesClubProxy(rawUrl),
125+
quality: extractQualityFromUrl(rawUrl) || '720p'
112126
};
113127
streams.push(stream);
114128
console.log(`[moviesclub] Added direct stream from iframe`);
@@ -209,11 +223,12 @@ async function handleMultipleServers(embedUrl, mediaType, season, episode, tmdbI
209223
console.log(`[moviesclub] Extracted stream URL: ${streamUrl.substring(0, 100)}...`);
210224

211225
// Create stream object
226+
const rawUrl = streamUrl;
212227
const stream = {
213228
name: `MoviesClub - ${serverName}`,
214229
title: `${mediaType === 'movie' ? 'Movie' : `S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`} ${tmdbId} - ${serverName}`,
215-
url: streamUrl,
216-
quality: extractQualityFromUrl(streamUrl) || '720p',
230+
url: applyMoviesClubProxy(rawUrl),
231+
quality: extractQualityFromUrl(rawUrl) || '720p',
217232
headers: {}
218233
};
219234

@@ -304,20 +319,17 @@ async function handleSingleServer(embedUrl, mediaType, season, episode, tmdbId)
304319

305320
// Extract streams from the configuration
306321
if (playerConfig.file) {
322+
const rawUrl = playerConfig.file;
307323
const stream = {
308324
name: `MoviesClub - ${playerConfig.title || 'Server 1'}`,
309325
title: playerConfig.title || `${mediaType === 'movie' ? 'Movie' : `S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`} ${tmdbId} - MoviesClub`,
310-
url: playerConfig.file,
311-
quality: extractQualityFromUrl(playerConfig.file) || '720p',
312-
headers: (() => {
313-
if (playerConfig.file.includes('vidora.stream')) {
314-
return {
315-
Origin: 'https://vidora.stream',
316-
Referer: 'https://vidora.stream/'
317-
};
318-
}
319-
return {};
320-
})()
326+
url: applyMoviesClubProxy(rawUrl),
327+
quality: extractQualityFromUrl(rawUrl) || '720p',
328+
// Always include vidora headers for single-server results to prevent 403 playback issues
329+
headers: {
330+
Origin: 'https://vidora.stream',
331+
Referer: 'https://vidora.stream/'
332+
}
321333
};
322334

323335
// Add poster if available
@@ -387,11 +399,12 @@ function extractStreamsFromServer(serverData, serverName, mediaType, season, epi
387399
console.log(`[moviesclub] Server response is not JSON, treating as direct URL: ${serverData.substring(0, 100)}`);
388400
// Treat as direct stream URL
389401
if (serverData.startsWith('http')) {
402+
const rawUrl = serverData;
390403
const stream = {
391404
name: `MoviesClub - ${serverName}`,
392405
title: `${mediaType === 'movie' ? 'Movie' : `S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`} ${tmdbId} - ${serverName}`,
393-
url: serverData,
394-
quality: extractQualityFromUrl(serverData) || '720p',
406+
url: applyMoviesClubProxy(rawUrl),
407+
quality: extractQualityFromUrl(rawUrl) || '720p',
395408
headers: serverData.includes('vidora.stream') ? { Origin: 'https://vidora.stream', Referer: 'https://vidora.stream/' } : {}
396409
};
397410
streams.push(stream);
@@ -409,12 +422,13 @@ function extractStreamsFromServer(serverData, serverName, mediaType, season, epi
409422
if (serverData[key] && typeof serverData[key] === 'string' && serverData[key].startsWith('http')) {
410423
console.log(`[moviesclub] Found stream URL in key '${key}': ${serverData[key].substring(0, 100)}`);
411424

425+
const rawUrl = serverData[key];
412426
const stream = {
413427
name: `MoviesClub - ${serverName}`,
414428
title: `${mediaType === 'movie' ? 'Movie' : `S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`} ${tmdbId} - ${serverName}`,
415-
url: serverData[key],
416-
quality: extractQualityFromUrl(serverData[key]) || '720p',
417-
headers: serverData[key].includes('vidora.stream') ? { Origin: 'https://vidora.stream', Referer: 'https://vidora.stream/' } : {}
429+
url: applyMoviesClubProxy(rawUrl),
430+
quality: extractQualityFromUrl(rawUrl) || '720p',
431+
headers: rawUrl.includes('vidora.stream') ? { Origin: 'https://vidora.stream', Referer: 'https://vidora.stream/' } : {}
418432
};
419433

420434
// Add poster if available

public/config.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ <h1>Paths</h1>
182182
<p class="hint">Provider enable/disable & feature flags apply immediately. Click toggles to enable (highlighted) or disable (dim).</p>
183183
<div class="adv-group">
184184
<div class="field small"><label>Showbox Cache Dir <input type="text" name="adv_showboxCacheDir" placeholder="/data/showbox-cache"/></label></div>
185+
<div class="field small"><label>MoviesClub Proxy URL <p class="hint">Optional. Example: <code>https://winter-surf-e49f.inside4ndroid-techsup.workers.dev/?destination=</code><br/>Leave blank for direct links. The raw stream URL will be appended (URL encoded).</p><input type="text" name="adv_moviesclubProxy" placeholder="https://proxy/?destination=" /></label></div>
185186
</div>
186187
</section>
187188
<section id="panel-live" class="panel">

public/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ function fillForm(data){
174174
advBools.forEach(([cfgKey, elName])=>{ const el = f.elements[elName]; if(!el) return; const src = (override[cfgKey]!==undefined? override[cfgKey] : merged[cfgKey]); if(el.type==='checkbox'){ el.checked = !!src; } else { el.value = src? 'true':''; } });
175175
const advTexts = [
176176
['showboxCacheDir','adv_showboxCacheDir']
177+
,['moviesclubProxy','adv_moviesclubProxy']
177178
];
178179
advTexts.forEach(([cfgKey, elName])=>{ const el = f.elements[elName]; if(!el) return; const val = override[cfgKey]!==undefined? override[cfgKey] : merged[cfgKey]; el.value = val || ''; });
179180
// Sync checkbox style advanced flags
@@ -257,6 +258,7 @@ async function save(){
257258
};
258259
Object.entries(boolMap).forEach(([formName,cfgKey])=>{ const el = f.elements[formName]; if(el) payload[cfgKey] = !!el.checked; });
259260
const textMap = { adv_showboxCacheDir:'showboxCacheDir' };
261+
textMap.adv_moviesclubProxy = 'moviesclubProxy';
260262
Object.entries(textMap).forEach(([formName,cfgKey])=>{ const el = f.elements[formName]; if(!el) return; const v = el.value.trim(); payload[cfgKey] = v? v : null; });
261263
const tmdbHidden = f.elements['tmdbApiKeysHidden'];
262264
if (tmdbHidden){

utils/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ function normalizeConfig(base) {
113113
// Proxy features removed; always use direct connections
114114
if (cfg.disableUrlValidation === undefined) cfg.disableUrlValidation = false;
115115
if (cfg.disable4khdhubUrlValidation === undefined) cfg.disable4khdhubUrlValidation = false;
116+
// MoviesClub optional proxy base (string URL with trailing ?destination= or similar)
117+
if (cfg.moviesclubProxy !== undefined && typeof cfg.moviesclubProxy === 'string') {
118+
cfg.moviesclubProxy = cfg.moviesclubProxy.trim();
119+
if (!cfg.moviesclubProxy) delete cfg.moviesclubProxy;
120+
}
116121
return cfg;
117122
}
118123

@@ -152,6 +157,8 @@ function applyConfigToEnv(cfg){
152157
delete process.env.VIDZEE_PROXY_URL;
153158
delete process.env.VIDSRC_PROXY_URL;
154159
delete process.env.MOVIESMOD_PROXY_URL;
160+
// Mirror moviesclub proxy for potential legacy usage
161+
if (cfg.moviesclubProxy) process.env.MOVIESCLUB_PROXY_URL = cfg.moviesclubProxy; else delete process.env.MOVIESCLUB_PROXY_URL;
155162
if (cfg.defaultRegion) process.env.FEBBOX_REGION = cfg.defaultRegion; // alias
156163
}
157164

0 commit comments

Comments
 (0)