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 <noreply@anthropic.com>
This commit is contained in:
primal
2026-01-28 21:49:11 -05:00
parent 5975df6771
commit c54005b5ba
+13
View File
@@ -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 {