Sharing image¶
V2.1SHARINGIMAGE stores the image URL selected for sharing an article. format_sharing_image formats your prepared metadata.
Requirements¶
Core package and caller-supplied metadata. No article retrieval or NLP model is required.
Example¶
from gdelt_regkg.fields.metadata import format_sharing_image
print(format_sharing_image("https://example.org/images/workshop.jpg"))
assert format_sharing_image("") == ""
assert format_sharing_image(None) is None
Behavior¶
Supply one absolute HTTP(S) URL without whitespace. "" means no image was found. None means the metadata is unavailable.
In RecordMetadata, pass sharing_image=. An encoded overrides["V2.1SHARINGIMAGE"] override takes precedence.
Limitations¶
Select the image and resolve relative URLs before formatting. The library does not parse HTML or check that the URL points to an accessible image.