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

Add Twitter GIF Support #9

Open
kupiakos opened this issue Mar 21, 2016 · 3 comments
Open

Add Twitter GIF Support #9

kupiakos opened this issue Mar 21, 2016 · 3 comments

Comments

@kupiakos
Copy link
Owner

Here

@kupiakos kupiakos changed the title Cannot mirror Twitter GIF Add Twitter GIF Support Mar 22, 2016
@spiral6
Copy link
Contributor

spiral6 commented Jul 2, 2016

The issue with Twitter gifs is that they're encoded in .mp4 files, not .gifs. To upload them, it might be better to use gfycat.com or vid.me to properly mirror them.

@kupiakos
Copy link
Owner Author

kupiakos commented Jul 4, 2016

Since Lapis Mirror already supports vid.me, it shouldn't be a huge problem. I'd like to avoid using gfycat as they specifically mention the case of a Reddit bot.

@spiral6
Copy link
Contributor

spiral6 commented Feb 9, 2017

We can use vid.me to mirror. Now, to get the URL from the tweet, this snippet demonstrates how to do so.

if tweet.extended_entities['media'][0]['type'] == 'animated_gif':
    video_info = tweet.extended_entities['media'][0]['video_info']
    print(video_info['variants'][0]['url'])

The variants array will always be a size of one. We would have to do this for every medium in the extended_entities array, which is already setup in twitter.py. So, that's it. Right now twitter.py only works if the tweet is of type 'photo', so there will be some logic added to it to ensure that Lapis can mirror .gifs from Twitter as well.

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

2 participants