From 3da30c7ab12c892f39f591abd18e52d6be9e8019 Mon Sep 17 00:00:00 2001 From: Zhuoyun Wei Date: Sat, 29 Jul 2023 22:40:55 -0700 Subject: [PATCH] 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)