Mercurial > rsstweet
diff app/lib/legit_client.rb @ 240:c454ea4f7b34 legit-client
Add support for note tweets (with no formatting)
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 03:24:56 +0900 |
parents | a04b4830eef2 |
children | 4bca1528675e |
line wrap: on
line diff
--- a/app/lib/legit_client.rb Sat Jul 15 01:59:44 2023 +0900 +++ b/app/lib/legit_client.rb Sat Jul 15 03:24:56 2023 +0900 @@ -95,7 +95,7 @@ def self.normalize_entity_urls(json) ret = {} - json.each do |entity_url| + (json || {}).each do |entity_url| ret[entity_url['url']] = entity_url['expanded_url'] end @@ -127,14 +127,14 @@ id: json['rest_id'], created_at: Time.parse(json['legacy']['created_at']), user: normalize_user(json['core']['user_results']['result']), - message: json['legacy']['full_text'], + message: json.dig('note_tweet', 'note_tweet_results', 'result', 'text') || json['legacy']['full_text'], retweet: normalize_tweet(json.dig('legacy', 'retweeted_status_result', 'result')), quote: normalize_tweet(json.dig('quoted_status_result', 'result')), quote_id: json['legacy']['quoted_status_id_str'], reply_to_id: json['legacy']['in_reply_to_status_id_str'], reply_to_user_id: json['legacy']['in_reply_to_user_id_str'], reply_to_username: json['legacy']['in_reply_to_screen_name'], - entity_urls: normalize_entity_urls(json['legacy']['entities']['urls']), + entity_urls: { **normalize_entity_urls(json['legacy']['entities']['urls']), **normalize_entity_urls(json.dig('note_tweet', 'note_tweet_results', 'result', 'entity_set', 'urls')) }, entity_media: normalize_entity_media(json.dig('legacy', 'extended_entities', 'media') || []), } end