From c54005b5bad3bec4aa0513b069daaa121943c58c Mon Sep 17 00:00:00 2001 From: primal Date: Wed, 28 Jan 2026 21:49:11 -0500 Subject: [PATCH] Upgrade BBC images from 240px to 800px for better quality BBC CDN supports larger image sizes by changing the URL path. Upgrade /standard/240/ and /standard/480/ to /standard/800/. Co-Authored-By: Claude Opus 4.5 --- publisher.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/publisher.go b/publisher.go index fb02eed..06edec0 100644 --- a/publisher.go +++ b/publisher.go @@ -556,7 +556,20 @@ func (p *Publisher) fetchAndUploadImage(session *PDSSession, imageURL string) *B return result.Blob } +// upgradeImageURL attempts to get a larger version of known CDN image URLs +func upgradeImageURL(imageURL string) string { + // BBC images: /standard/240/ -> /standard/800/ + if strings.Contains(imageURL, "ichef.bbci.co.uk") { + imageURL = strings.Replace(imageURL, "/standard/240/", "/standard/800/", 1) + imageURL = strings.Replace(imageURL, "/standard/480/", "/standard/800/", 1) + } + return imageURL +} + func (p *Publisher) fetchAndUploadImageWithDimensions(session *PDSSession, imageURL string) *ImageUploadResult { + // Upgrade image URL to larger size if possible + imageURL = upgradeImageURL(imageURL) + // Fetch the image resp, err := p.httpClient.Get(imageURL) if err != nil {