Skip to content

Social image embeds

V2.1SOCIALIMAGEEMBEDS stores supplied social-post URLs containing images. format_social_image_embeds formats the collection as one Global Knowledge Graph (GKG) cell.

Requirements

Core package and caller-supplied metadata. No article retrieval or NLP model is required.

Example

from gdelt_regkg.fields.metadata import format_social_image_embeds

urls = ["https://example.org/posts/photo"]

print(format_social_image_embeds(urls))
assert format_social_image_embeds([]) == ""
assert format_social_image_embeds(None) is None
https://example.org/posts/photo

Behavior

Supply a collection of absolute HTTP(S) URLs without whitespace. Entries are separated by ;. Order and duplicates are preserved. Literal semicolons inside URLs become %3B, and existing percent escapes are unchanged.

An empty collection means no matching media. None means metadata is unavailable. A prejoined string is rejected.

In RecordMetadata, pass social_image_embeds=. An encoded overrides["V2.1SOCIALIMAGEEMBEDS"] override takes precedence.

Limitations

Identify posts containing images before formatting. Resolve relative URLs yourself. The library does not retrieve pages or verify their media content.

Sharing image · Generate records · GKG 2.1 format

GKG field reference