Mercurial > rsstweet
diff app/lib/legit_client.rb @ 237:961d362e42c7 legit-client
The url in entity media isn't unique as they all point to the same thing
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 01:47:34 +0900 |
parents | 498043313523 |
children | a04b4830eef2 |
line wrap: on
line diff
--- a/app/lib/legit_client.rb Sat Jul 15 01:40:31 2023 +0900 +++ b/app/lib/legit_client.rb Sat Jul 15 01:47:34 2023 +0900 @@ -62,9 +62,8 @@ val = {} if entity_media['type'] == 'photo' - val[:url] = entity_media['media_url_https'] + val[:image_url] = entity_media['media_url_https'] elsif entity_media['type'] == 'video' - val[:url] = entity_media['expanded_url'] val[:variants] = entity_media['video_info']['variants'] .filter { |variant| variant['bitrate'].present? } .map do |variant| @@ -76,11 +75,18 @@ end if !val.empty? + val[:url] = entity_media['expanded_url'] val[:type] = entity_media['type'] val[:id] = entity_media['media_key'] end - ret[entity_media['display_url']] = val + key = if ret[entity_media['display_url']].nil? + entity_media['display_url'] + else + entity_media['media_key'] + end + + ret[key] = val end ret