Add emoji to statuses

This commit is contained in:
2024-03-24 17:24:48 +11:00
parent adb84e0d73
commit 2b1363294b
11 changed files with 99 additions and 21 deletions

View File

@@ -53,11 +53,23 @@ module Main
doc.at("//img")
end
def inline_image_sources
inline_images
&.select {|attr, _value| attr == "src"}
&.map {|img| img[1] } || []
end
def photo_sources
photos.map{|photo| photo["value"]}
end
def prefix_emoji
if name
nil
elsif photos? && content == ""
"📷"
elsif __getobj__.emoji
__getobj__.emoji
else
@prefix_emoji ||= if (match = content.match(Unicode::Emoji::REGEX))
match
@@ -133,6 +145,15 @@ module Main
__getobj__.trips
end
def to_h
{
id: slug,
emoji: prefix_emoji,
content: raw_content,
images: (inline_image_sources + photo_sources).compact
}
end
private
# e.g. geo:-37.75188,144.90417;u=35