fix(latest): read asura cover from coverUrl prop and send Chrome UA

- asura og:image is now a 1200x630 social card on the challenged main host; read the astro-island coverUrl prop instead.
- cdn.asurascans.com challenges Go's default User-Agent; TLSCoverFetcher now sends chromeUA.
This commit is contained in:
2026-12-04 23:28:59 +07:00
parent 3a83161b1c
commit 9209b6fb2c
4 changed files with 47 additions and 9 deletions
@@ -228,6 +228,24 @@ func TestCoverFetcherRejectsNonImage(t *testing.T) {
}
}
// cdn.asurascans.com challenges Go's default User-Agent (measured 2026-12-04),
// so every cover from it failed until the fetcher sent a browser one.
func TestCoverFetcherSendsBrowserUserAgent(t *testing.T) {
client := &http.Client{Transport: roundTripFunc(func(r *http.Request) (*http.Response, error) {
if r.UserAgent() != chromeUA {
return coverResponse(http.StatusForbidden, "text/html", "", []byte("Just a moment...")), nil
}
return coverResponse(http.StatusOK, "image/webp", "", []byte("cover-bytes")), nil
})}
fetcher := newCoverFetcher(client, func(context.Context, string) ([]netip.Addr, error) {
return []netip.Addr{netip.MustParseAddr("198.51.100.10")}, nil
})
if _, _, err := fetcher.Fetch(context.Background(), "https://cdn.asurascans.com/asura-images/covers/x.webp"); err != nil {
t.Fatalf("Fetch: %v", err)
}
}
// comix labels its covers "image/jpg", which is not a registered type but is
// what the Site actually answers with; the bytes are stored under the real
// name so one image cannot land under two spellings.