Skip to content

Commit cade561

Browse files
committed
fix(download): set Referer for AnimeFire CDN (lightspeedst.net)
lightspeedst.net, the CDN used by AnimeFire, returns 401 Unauthorized on token-signed requests when the Referer header is absent. The batch download path called downloadDirectHTTP without ever setting the global referer for AnimeFire sources, since the AnimeFire scraper does not call SetGlobalReferer. Guard: only set the referer when none is already active so other sources are not affected. Fixes: "The Angel Next Door Spoils Me Rotten" (and any AnimeFire anime) failing to download with HTTP 401 Unauthorized in batch mode.
1 parent f6f801e commit cade561

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/player/download.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ type directDownloadFunc func(string, string, *model) error
377377
type fallbackResolveFunc func(string, string) (string, error)
378378

379379
func downloadAnimeFireDirectWithFallback(videoAPIURL, videoURL, path string, m *model) error {
380+
// lightspeedst.net (AnimeFire CDN) requires Referer: https://animefire.io to authorise
381+
// token-signed requests. Ensure it is set before the download client sends any request.
382+
if util.GetGlobalReferer() == "" {
383+
util.SetGlobalReferer("https://animefire.io")
384+
}
380385
return runAnimeFireDirectDownloadWithFallback(
381386
videoAPIURL,
382387
videoURL,

0 commit comments

Comments
 (0)