File size: 2,261 Bytes
aa037d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: Streaming Provider API
emoji: 🎬
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
---

# StreamHub API β€” Node.js Implementation

Streaming provider aggregator with embedded proxy. Aggregates 8 providers, returns playable HLS/MP4 URLs via SSE, proxies streams through embedded middleman with M3U8 rewriting.

## Endpoints

| Route | Description |
|---|---|
| `GET /movie?id={tmdb_id}` | SSE stream of provider results for movie |
| `GET /tv?id={tmdb_id}&season={s}&episode={e}` | SSE stream of provider results for TV episode |
| `GET /api?url={target}&{sourceParam}=1` | Embedded proxy β€” M3U8 rewriting, streaming byte pipe |
| `GET /api?providers=1` | List active providers |
| `GET /` | API info |

### SSE Events (`/movie`, `/tv`)

```
data: {"type":"meta","meta":{...}}
data: {"type":"source","source":{"source":"vidlink","label":"VidLink","url":"/api?url=...&vl=1"}}
data: {"type":"done","total":8}
```

### Proxy (`/api`)

Every stream URL is wrapped through the embedded proxy with a source-specific parameter:

```
/api?url=https%3A%2F%2Fcdn.example.com%2Fstream.m3u8&vr=1&proxyHeaders=%7B%22Referer%22%3A%22...%22%7D
```

The proxy:
- Detects M3U8 β†’ rewrites all segment/key URIs through itself
- Pipes binary streams directly (Readable.fromWeb β†’ pipe) with Range header support
- Follows up to 5 redirects, forces HTTPS
- Injects CDN-specific headers from provider config

## Providers

| Key | Label | Source |
|---|---|---|
| `videasy` | Videasy | api.videasy.to + enc-dec.app decryption |
| `vidfast` | VidFast | vidfast.pro + enc-dec.app encrypt/decrypt |
| `vidlink` | VidLink | enc-dec.app β†’ vidlink.pro API |
| `hexa` | Hexa | hexa.su + enc-dec.app decryption |
| `lordflix` | LordFlix | snowhouse.lordflix.club + enc-dec.app |
| `vaplayer` | VA Player | streamdata.vaplayer.ru API |
| `rivestream` | RiveStream | rivestream.app + CF worker |
| `vidrock` | VidRock | AES-CBC encode β†’ vidrock.ru API |

## Run

```bash
node server.js
```

Port: `7860` (configurable via `PORT` env).

## Deploy

### HuggingFace Spaces

Create Space with Docker SDK. `SPACE_ID` env auto-detected β€” adjusts timeouts and concurrency.

### Docker

```bash
docker build -t streamhub-api .
docker run -p 7860:7860 streamhub-api
```