Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading videos instead of images #19

Open
Tvax opened this issue Mar 9, 2018 · 3 comments
Open

Uploading videos instead of images #19

Tvax opened this issue Mar 9, 2018 · 3 comments

Comments

@Tvax
Copy link
Contributor

Tvax commented Mar 9, 2018

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.

@yair
Copy link

yair commented May 4, 2018

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.

@yair
Copy link

yair commented May 4, 2018

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

@joenepraat
Copy link

Mastodon-Twitter Crossposter handles videos without problem, so it should be possible indeed.

Very much wanted by me this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants