social-feed icon indicating copy to clipboard operation
social-feed copied to clipboard

Twitter don't show images in the feed

Open mutiullah7 opened this issue 7 years ago • 11 comments

Twitter feed doesn't show images which are added into the tweets, like @audi have images in the tweet attached, but feed don't show images.

mutiullah7 avatar May 04 '17 16:05 mutiullah7

Maybe my pull request (#240) solves the problem. Can you test that branch? If it works I'll merge the pull request.

martijngastkemper avatar May 05 '17 12:05 martijngastkemper

It show images, but now all, some images are missing from the tweets, also i noticed, it also show those tweets which i've relied to, (the replied tweets), if i only want to show the tweets i've tweeted not replied tweets, any option for that? like i just only want to show my tweets not the replies i've made to others. i hope you got my point, what im trying to say.

mutiullah7 avatar May 05 '17 13:05 mutiullah7

Did the replies appear after you applied #240 or did you already have that problem. If the last is the case you need to open a new issue, because that's off topic

martijngastkemper avatar May 05 '17 14:05 martijngastkemper

No I already have that problem, but back to the topic, i've added the tweet_mode also changed the script you changed in #240 but no success not all the images shows up, some images are still missing.

mutiullah7 avatar May 05 '17 14:05 mutiullah7

Did you set set tweet_mode to extended?

martijngastkemper avatar May 05 '17 15:05 martijngastkemper

both, compatibility and extended

mutiullah7 avatar May 05 '17 16:05 mutiullah7

I had the same problem. Some tweets show images some don't even though they have images. I did some research and found out enabling extended mode is half the solution. After that you need to use extended_entities under retweeted_status in API response to access media of extended retweets. I'm not sure about extended non-retweets.

taylankasap avatar May 07 '17 17:05 taylankasap

Hi @taylankasap how can i use extended_entities please help me with it

mutiullah7 avatar Jun 08 '17 18:06 mutiullah7

@mutiullah7 you'll need to manually change the jquery.socialfeed.js file. Find the Feed.twitter.utility.unifyPostData function body. There is an ìf block (options.show_media === true) there. Since I only needed to use extended mode I'm not sure if this still works with compatibility mode so if you need to use both modes you may need to modify it. Here is the code I used inside that if block:

var elementEntities = {};
if (element.entities.media && element.entities.media.length > 0) {
    elementEntities = element.entities;
} else if (element.retweeted_status && element.retweeted_status.extended_entities && element.retweeted_status.extended_entities.media && element.retweeted_status.extended_entities.media.length > 0) {
    elementEntities = element.retweeted_status.extended_entities;
}

if (elementEntities.media && elementEntities.media.length > 0) {
    var image_url = elementEntities.media[0].media_url;
    if (image_url) {
        post.attachment = '<img class="attachment" src="' + image_url + '" />';
    }
}

taylankasap avatar Jun 09 '17 04:06 taylankasap

Doesn't help, no images still after adding the code as you suggested.

mutiullah7 avatar Sep 07 '17 16:09 mutiullah7

@martijngastkemper Thanks dude, your solution has solved it, just got your updated jquery.socialfeed.js file as is replaced the old one with it, then I used tweet_mode: 'extended' in the calling function and it worked as expected :)

asalem1990 avatar Dec 28 '17 23:12 asalem1990