Delete README.md
Browse files
README.md
DELETED
|
@@ -1,128 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: FotStream Resolver
|
| 3 |
-
emoji: ⚽
|
| 4 |
-
sdk: docker
|
| 5 |
-
app_port: 7860
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
# FotStream Hugging Face Resolver
|
| 9 |
-
|
| 10 |
-
This Space resolves a stream on demand by match ID.
|
| 11 |
-
|
| 12 |
-
It does not use MySQL, `stream-save.php`, or `stream.php`.
|
| 13 |
-
|
| 14 |
-
## Flow
|
| 15 |
-
|
| 16 |
-
1. Blogger calls:
|
| 17 |
-
|
| 18 |
-
`GET /resolve?id=MATCH_ID`
|
| 19 |
-
|
| 20 |
-
2. The resolver fetches:
|
| 21 |
-
|
| 22 |
-
`https://miniplaying.com/api/matches.php?lang=en&scope=all`
|
| 23 |
-
|
| 24 |
-
3. It finds that match and reads its `watch_url`.
|
| 25 |
-
|
| 26 |
-
4. Method 1: Puppeteer opens the watch page and captures HLS `.m3u8`.
|
| 27 |
-
|
| 28 |
-
5. If no HLS was detected, Method 2 extracts the `mk`/`key` query parameter and calls the watch-card API.
|
| 29 |
-
|
| 30 |
-
6. The watch-card fallback prefers an enabled `m3u8` server. If there is no `m3u8`, it returns another enabled server URL such as `iframe`.
|
| 31 |
-
|
| 32 |
-
## Endpoints
|
| 33 |
-
|
| 34 |
-
### Health
|
| 35 |
-
|
| 36 |
-
`GET /health`
|
| 37 |
-
|
| 38 |
-
Example:
|
| 39 |
-
|
| 40 |
-
```json
|
| 41 |
-
{
|
| 42 |
-
"status": "ok",
|
| 43 |
-
"service": "fotstream-resolver",
|
| 44 |
-
"endpoint": "/resolve?id=MATCH_ID"
|
| 45 |
-
}
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
### Resolve one match
|
| 49 |
-
|
| 50 |
-
`GET /resolve?id=5970091`
|
| 51 |
-
|
| 52 |
-
Successful HLS example:
|
| 53 |
-
|
| 54 |
-
```json
|
| 55 |
-
{
|
| 56 |
-
"success": true,
|
| 57 |
-
"status": "ready",
|
| 58 |
-
"match_id": "5970091",
|
| 59 |
-
"stream_url": "https://example.com/index.m3u8",
|
| 60 |
-
"stream_type": "m3u8",
|
| 61 |
-
"source": "puppeteer"
|
| 62 |
-
}
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
-
Watch-card HLS example:
|
| 66 |
-
|
| 67 |
-
```json
|
| 68 |
-
{
|
| 69 |
-
"success": true,
|
| 70 |
-
"status": "ready",
|
| 71 |
-
"match_id": "5970091",
|
| 72 |
-
"stream_url": "https://example.com/index.m3u8?token=...",
|
| 73 |
-
"stream_type": "m3u8",
|
| 74 |
-
"source": "watch-card-api",
|
| 75 |
-
"fallback_url": "https://player.example.com/?channel=th1",
|
| 76 |
-
"fallback_type": "iframe"
|
| 77 |
-
}
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
-
If no HLS exists but an iframe/player server exists:
|
| 81 |
-
|
| 82 |
-
```json
|
| 83 |
-
{
|
| 84 |
-
"success": true,
|
| 85 |
-
"status": "ready",
|
| 86 |
-
"match_id": "5970091",
|
| 87 |
-
"stream_url": "https://player.example.com/?channel=th1",
|
| 88 |
-
"stream_type": "iframe",
|
| 89 |
-
"source": "watch-card-api"
|
| 90 |
-
}
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
If `watch_url` is not available yet:
|
| 94 |
-
|
| 95 |
-
```json
|
| 96 |
-
{
|
| 97 |
-
"success": false,
|
| 98 |
-
"status": "waiting",
|
| 99 |
-
"match_id": "5970091",
|
| 100 |
-
"stream_url": null
|
| 101 |
-
}
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
## Hugging Face settings
|
| 105 |
-
|
| 106 |
-
No stream database secret is required.
|
| 107 |
-
|
| 108 |
-
Optional variable:
|
| 109 |
-
|
| 110 |
-
- `RESOLVE_CACHE_TTL_MS`: successful resolution cache in milliseconds. Default: `60000`.
|
| 111 |
-
|
| 112 |
-
The resolver has CORS enabled so Blogger can call `/resolve` directly.
|
| 113 |
-
|
| 114 |
-
## Test
|
| 115 |
-
|
| 116 |
-
```bash
|
| 117 |
-
curl https://YOUR-SPACE.hf.space/health
|
| 118 |
-
```
|
| 119 |
-
|
| 120 |
-
Then:
|
| 121 |
-
|
| 122 |
-
```bash
|
| 123 |
-
curl "https://YOUR-SPACE.hf.space/resolve?id=5970091"
|
| 124 |
-
```
|
| 125 |
-
|
| 126 |
-
## Important
|
| 127 |
-
|
| 128 |
-
Some stream providers issue signed URLs tied to IP, cookies, headers, or short expiry windows. In those cases a URL resolved from Hugging Face may not be playable directly from another visitor's browser. The API also exposes alternate iframe/player URLs from the watch-card response when available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|