-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Description:
IINA's built-in OpenSubtitles integration is failing to retrieve subtitles when logged in as a VIP user, producing an "Invalid domain" (401) error.
Root Cause:
The OpenSubtitles API enforces alphabetical ordering of query parameters and returns a 301 redirect when they're out of order. IINA's HTTP client either:
- Does not follow redirects, OR
- Follows redirects but loses authentication headers or changes the domain incorrectly
Steps to Reproduce:
- Log into OpenSubtitles with a VIP account in IINA
- Play any video file
- Trigger automatic subtitle search
- Check Console logs
Actual Behavior:
[opensubapi][d] Request: {
"url" : "https://vip-api.opensubtitles.com/api/v1/subtitles?languages=en&moviehash=413142fb64bcd269&query=Frozen.2013.1080p.BluRay.x264.YIFY",
"httpMethod" : "GET"
}
[opensubapi][d] HTTP response status code: 401 unauthorized
[opensubapi][d] Response: {
"errors" : ["Invalid domain"],
"status" : 401
}
Expected Behavior:
The request should either:
- Send parameters in strict alphabetical order (case-insensitive) to avoid the redirect, OR
- Follow the 301 redirect while preserving all headers (especially Authorization and Api-Key)
Technical Details:
Testing with curl confirms the issue:
Without following redirects (fails):
curl -v 'https://vip-api.opensubtitles.com/api/v1/subtitles?query=frozen&moviehash=abc123'
--header 'Api-Key: xxx'
--header 'Authorization: Bearer xxx'
Returns: HTTP/2 301
Location: /api/v1/subtitles?moviehash=abc123&query=frozen
(parameters reordered alphabetically)
With redirect following (works):
curl -L 'https://vip-api.opensubtitles.com/api/v1/subtitles?query=frozen&moviehash=abc123'
--header 'Api-Key: xxx'
--header 'Authorization: Bearer xxx'
Returns: HTTP/2 200 (success)
Proposed Solutions:
- Best practice: Sort query parameters alphabetically (case-insensitive) before making the request to avoid redirects entirely
- Fallback: Ensure IINA's HTTP client follows 301/302 redirects while preserving all headers
Environment:
- IINA version: 1.4.1
- macOS version: 26.0.1
- OpenSubtitles account: VIP member