Merge pull request #413 from mdashlw/bluesky-update

Handle bluesky's recordWithMedia
This commit is contained in:
liamwhite 2025-02-11 08:50:43 -05:00 committed by GitHub
commit 02aed2c7e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,13 +31,15 @@ defmodule PhilomenaProxy.Scrapers.Bluesky do
|> Map.fetch!("posts") |> Map.fetch!("posts")
|> hd() |> hd()
images = post_json["embed"]["images"] || post_json["embed"]["media"]["images"] || []
%{ %{
source_url: url, source_url: url,
author_name: domain_first_component(post_json["author"]["handle"]), author_name: domain_first_component(post_json["author"]["handle"]),
description: post_json["record"]["text"], description: post_json["record"]["text"],
images: images:
Enum.map( Enum.map(
post_json["embed"]["images"], images,
&%{ &%{
url: String.replace(&1["fullsize"], @fullsize_image_regex, @blob_image_url_pattern), url: String.replace(&1["fullsize"], @fullsize_image_regex, @blob_image_url_pattern),
camo_url: PhilomenaProxy.Camo.image_url(&1["thumb"]) camo_url: PhilomenaProxy.Camo.image_url(&1["thumb"])