From 60bcc061dc4bd837604e435f03b8c62d33412540 Mon Sep 17 00:00:00 2001 From: Zhuoyun Wei Date: Sat, 29 Jul 2023 22:14:28 -0700 Subject: [PATCH 1/2] fix: add media type to toot-converted tweet --- ash.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ash.py b/ash.py index 769358e..4417bc4 100644 --- a/ash.py +++ b/ash.py @@ -80,6 +80,7 @@ def toot_to_tweet(status: dict) -> dict: } media = [ { + 'type': att.get('type'), 'media_url_https': att['url'], 'description': att['description'] } @@ -447,8 +448,8 @@ def get_tweet(tweet_id, ext): videos.append({ 'url': media_url, }) - # type is photo - elif m.get('type') == 'photo': + # type is photo (tweet) or image (toot) + elif m.get('type') in ('photo', 'image'): media_url = m['media_url_https'] if not _is_external_tweet: media_url = replace_media_url(media_url) From 3da30c7ab12c892f39f591abd18e52d6be9e8019 Mon Sep 17 00:00:00 2001 From: Zhuoyun Wei Date: Sat, 29 Jul 2023 22:40:55 -0700 Subject: [PATCH 2/2] fix: toot video --- ash.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ash.py b/ash.py index 4417bc4..951ed08 100644 --- a/ash.py +++ b/ash.py @@ -80,7 +80,7 @@ def toot_to_tweet(status: dict) -> dict: } media = [ { - 'type': att.get('type'), + 'type': 'toot-' + att.get('type', ''), 'media_url_https': att['url'], 'description': att['description'] } @@ -448,8 +448,12 @@ def get_tweet(tweet_id, ext): videos.append({ 'url': media_url, }) + elif m.get('type') == 'toot-video': + videos.append({ + 'url': m['media_url_https'] + }) # type is photo (tweet) or image (toot) - elif m.get('type') in ('photo', 'image'): + elif m.get('type') in ('photo', 'toot-image'): media_url = m['media_url_https'] if not _is_external_tweet: media_url = replace_media_url(media_url)