Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #172 where the AnimePahe provider was unable to stream or download anime. The fix adds proper HTTP headers required by the CDN provider to successfully stream content.
Key Changes:
- Extracts the actual stream host from the stream URL and uses it in the
Hostheader - Adds comprehensive
STREAM_HEADERSwith CORS-compliant headers (Origin, Referer, etc.) - Passes custom headers to the
Serverobject so they're used during download/streaming
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
viu_media/libs/provider/anime/animepahe/provider.py |
Adds logic to extract stream hostname from URLs and constructs custom headers combining User-Agent, dynamic Host, and STREAM_HEADERS for streaming |
viu_media/libs/provider/anime/animepahe/mappers.py |
Updates map_to_server function signature to accept and pass headers to the Server object |
viu_media/libs/provider/anime/animepahe/constants.py |
Defines new CDN provider constants and STREAM_HEADERS with CORS-compliant headers for successful streaming |
viu_media/core/downloader/yt_dlp.py |
Adds debug logging to show the URL and headers being used during download for troubleshooting |
| "DNT": "1", | ||
| "Connection": "keep-alive", | ||
| "Referer": "https://animepahe.si/", | ||
| "Referer": ANIMEPAHE_BASE + '/', |
There was a problem hiding this comment.
The string concatenation pattern using + operator is inconsistent with the f-string style used elsewhere in this file. Consider using f-strings for consistency: "Referer": f"{ANIMEPAHE_BASE}/"
| "Origin": CDN_PROVIDER_BASE, | ||
| "Sec-GPC": "1", | ||
| "Connection": "keep-alive", | ||
| "Referer": CDN_PROVIDER_BASE + '/', |
There was a problem hiding this comment.
The string concatenation pattern using + operator is inconsistent with the f-string style used elsewhere in this file. Consider using f-strings for consistency: "Referer": f"{CDN_PROVIDER_BASE}/"
| "Referer": CDN_PROVIDER_BASE + '/', | |
| "Referer": f"{CDN_PROVIDER_BASE}/", |
|
it works great |
fix #172