joealcorn / TweetPoster

a reddit bot
http://www.reddit.com/u/TweetPoster
MIT License
54 stars 13 forks source link

Not recognising GIF images #15

Open Spam78 opened 9 years ago

Spam78 commented 9 years ago

TweetPoster only links and rehosts the thumbnail of the image, which means that for a GIF, only one frame is shown.

For example, compare this tweet: https://twitter.com/Pyrao/status/609881586847326208 and TweetPoster's post: http://www.reddit.com/r/mindcrack/comments/39s4um/pyropunchers_dank_poose_meme/cs5y3kv

AustinDizzy commented 9 years ago

This is because it is using the entities object to search for the GIF data (as seen here) when it should be using the extended_entities object, which contains direct mp4 links for the video as opposed to just video thumbnails. utils.replace_entities should then properly rehost the mp4 on gfycat.

If nobody else takes care of this, I may do it myself.

AustinDizzy commented 9 years ago

Or it could do it a rather hacky way and remove "_thumb" and replace ".png" with ".mp4" in the URL, like so:

Before - http://pbs.twimg.com/tweet_video_thumb/CJVg-83UAAIJxT4.png After - http://pbs.twimg.com/tweet_video/CJVg-83UAAIJxT4.mp4

Crazy-Duck commented 8 years ago

You're going to have to use the hacky way, since extended_entities still aren't supported by the twitter API. See here