# Stremio Addon Endpoint Testing & Marketplace Maintenance

When debugging a Stremio-compatible addon system, **always test the actual HTTP endpoints before assuming logic is broken.** The addon ecosystem shifts rapidly — hosts die, domains expire, and endpoints 404.

## Live Testing Protocol

```bash
# Test manifest endpoint
curl -s -o /dev/null -w "HTTP %{http_code} in %{time_total}s\n" "https://torrentio.strem.fun/manifest.json"

# Test stream endpoint
curl -s "https://torrentio.strem.fun/stream/movie/tt0111161.json" | python3 -c "
import sys, json
d = json.load(sys.stdin)
s = d.get('streams', [])
print(f'Streams: {len(s)}, hasUrl: {sum(1 for x in s if x.get(\"url\"))}, hasHash: {sum(1 for x in s if x.get(\"infoHash\"))}')
"

# Bulk marketplace audit
for url in "https://torrentio.strem.fun/manifest.json" "https://comet.elfhosted.com/manifest.json" ...; do
  code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 "$url" 2>/dev/null || echo "000")
  printf "  %-40s → %s\n" "$(echo $url | sed 's|https://||;s|/manifest.json||')" "$code"
done
```

**Key code meanings:**
- `000` → DNS resolution failed (NXDOMAIN or connection refused) — **dead**
- `200` → working ✅
- `302` → redirect — may work, follow up
- `404` → endpoint doesn't exist on that host — **dead**
- `403` → blocked (CDN/rate-limit) — **effectively dead**

## Critical Ecosystem Facts (as of May 2026)

### Dead TLD: `*.stremio-addon.app`
Every addon using this TLD is unreachable (NXDOMAIN). The domain no longer resolves.
- `notorrent.stremio-addon.app` → DEAD
- `peerflix.stremio-addon.app` → DEAD
- `dmm-cast.stremio-addon.app` → DEAD
- `local-files.stremio-addon.app` → DEAD
- `subdl.stremio-addon.app` → untested, likely dead

### Reliable Hosting: `*.elfhosted.com`
This is the most reliable public hosting platform for Stremio addons.
**Working (200):**
- `torrentio.strem.fun` (not elfhosted, but the #1 addon)
- `comet.elfhosted.com`
- `mediafusion.elfhosted.com`
- `jackettio.elfhosted.com`

**Dead on elfhosted (404):**
- `debridio.elfhosted.com`
- `streamfusion.elfhosted.com`
- `cyberflix.elfhosted.com`
- `stremthru.elfhosted.com`

### Torrentio Behavior Without Debrid Token
Calling Torrentio's `/stream/{type}/{id}.json` without a debrid token returns:
- 50 streams with `infoHash` populated
- **ALL `url` fields are `null`**
- Streams can't be played without a debrid bridge

This means a `DebridEnricher` pipeline stage is **mandatory** — it must check the fetched infoHashes against connected debrid services to determine which streams are cached and resolvable.

### Torrentio Behavior With Debrid Token
With a valid debrid token (e.g., `realdebrid=TOKEN` in URL), Torrentio returns:
- `url` field populated (Torrentio acts as a debrid proxy)
- Multiple providers can be combined: `realdebrid=TOK1|alldebrid=TOK2`

## Marketplace Maintenance Checklist

When maintaining the addon marketplace:
1. Test ALL manifest URLs with `curl` — 30s timeout covers all
2. Remove any returning `000`, `404`, or `403`
3. Verify `302` redirects resolve to `200` at final destination
4. Add new working providers from elfhosted
5. Keep Torrentio, Comet, MediaFusion as the core three
6. Only list addons that return `200` on their manifest endpoint
