Open Tvax opened 6 years ago
If I understand correctly, according to this discussion -- https://twittercommunity.com/t/tweet-with-gif-media-shows-as-having-jpeg-media/62284/3 -- this is a backward compatibility issue - by default videos are returned by the twitter API as jpegs to avoid confusing older clients. To get the actual movie one needs to use the extended_entities API.
This fixes the issue for animated gifs for me. A less hacky solution probably exists (and might support other types of videos).
diff --git a/t2m/__init__.py b/t2m/__init__.py
index 3afc8da..1b554cd 100644
--- a/t2m/__init__.py
+++ b/t2m/__init__.py
@@ -216,7 +216,7 @@ def _collect_toots(twitter_client, twitter_handle, done=(), retweets=False,
"text": toot_text,
"content_warning": warning,
"id": i.id,
- "medias": [x.media_url for x in media] if media else []
+ "medias": [x.video_info['variants'][0]['url'] if x.type == "animated_gif" else x.media_url for x in media] if media else []
})
return toots
Mastodon-Twitter Crossposter handles videos without problem, so it should be possible indeed.
Very much wanted by me this feature.
It could be awesome if the script could upload the entire video instead of only uploading an image of it. Like only uploading an image if uploading the video to Mastodon fails.