Add support for app.bsky.embed.gallery
All checks were successful
/ build (push) Successful in 2m5s

This commit is contained in:
Astra 2026-06-09 09:18:36 +01:00
parent 025282ff39
commit 7e147cb2a8

View file

@ -84,12 +84,13 @@ type PostRecord struct {
} }
type Embed struct { type Embed struct {
Type string `json:"$type,omitempty"` Type string `json:"$type,omitempty"`
Media *Media `json:"media,omitempty"` Media *Media `json:"media,omitempty"`
Images []Images `json:"images,omitempty"` Images []Images `json:"images,omitempty"`
Video *Video `json:"video,omitempty"` Video *Video `json:"video,omitempty"`
Record *PostRecord `json:"record,omitempty"` Record *PostRecord `json:"record,omitempty"`
External *External `json:"external,omitempty"` External *External `json:"external,omitempty"`
GalleryItems []Images `json:"items,omitempty"`
} }
type Values struct { type Values struct {
@ -425,6 +426,16 @@ func (p *Post) GetEmbeds() []ParsedEmbeds {
}) })
} }
case "app.bsky.embed.gallery":
for _, item := range p.Embed.GalleryItems {
if item.Image != nil && item.Image.Ref != nil {
parsedEmbeds = append(parsedEmbeds, ParsedEmbeds{
URI: item.Image.Ref.Link,
Type: "image",
})
}
}
case "app.bsky.embed.recordWithMedia": case "app.bsky.embed.recordWithMedia":
// Quote post - also extract the media it contains // Quote post - also extract the media it contains
if p.Embed.Record != nil { if p.Embed.Record != nil {