Use BBC's clean image variant (cpsprodpb) instead of the branded one
BBC's og:image comes from the "branded_news" CDN path with a "BBC NEWS" logo baked into the picture (shows as "…EWS" once the hero crops it). The identical photo is served under "cpsprodpb" with no logo, so rewrite branded_news → cpsprodpb. Best of both: full-resolution hero, no burned-in branding. Re-enriched recent briefs so live images swap over. 99 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,8 +77,9 @@ def test_rejects_generic_share_images():
|
||||
assert og_image_from_html(b'<meta property="og:image" content="https://x.com/og-default.jpg">') is None
|
||||
# a real article image comes through
|
||||
assert og_image_from_html(b'<meta property="og:image" content="https://x.com/real-photo.jpg">') == "https://x.com/real-photo.jpg"
|
||||
# BBC's branded_news path is a REAL photo path, not a placeholder — keep it
|
||||
assert og_image_from_html(b'<meta property="og:image" content="https://ichef.bbci.co.uk/news/1024/branded_news/x.jpg">') == "https://ichef.bbci.co.uk/news/1024/branded_news/x.jpg"
|
||||
# BBC's branded_news path is a real photo (logo baked in) — keep it, but swap
|
||||
# to the clean cpsprodpb variant so the hero isn't branded
|
||||
assert og_image_from_html(b'<meta property="og:image" content="https://ichef.bbci.co.uk/news/1024/branded_news/x.jpg">') == "https://ichef.bbci.co.uk/news/1024/cpsprodpb/x.jpg"
|
||||
# if the first og is a generic placeholder but a later one is real, take the real one
|
||||
html = (b'<meta property="og:image" content="https://x.com/og-default.jpg">'
|
||||
b'<meta property="og:image" content="https://x.com/article.jpg">')
|
||||
|
||||
Reference in New Issue
Block a user