Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 18, 2013 @ 12:20
    Dan Diplo
    0

    Tweet Count Bug

    First, let me say what an awsome package this is - I've done stuff with Twitter and oAuth and know how unpleasant it can be, so great work!

    I've noticed a small bug in the LatestTweets.xslt macro

    You can set the param "numberOfTweetsToDisplay" to a number - which should govern how many tweets are displated. However, if you have also set "includeReplies" and "includeRetweets" to "false" and your feed contains replies and/or retweets then these are removed after the selection is made, rather than before.

    So, if you ask for 3 tweets then it gets the first 3 tweets and then removes replies and retweets. So if you're last 3 tweets all happen to be replies then you'd get zero tweets displaying. So it should do pruning before the "take" part of the query.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 18, 2013 @ 12:31
    Matt Brailsford
    0

    Hi Dan,

    Glad you are liking it so far.

    Unfortunately, that's how the twitter API processes those requests (I just pass the values straight through), so to make it work would require uTwit to pull back way more results than you asked for, and then prune them, hoping there will be enough results left to fulfil your quota, however, even with that it would be possible to not have enough. Ultimately I have just kept it true to the twitter API, so if you need to prune, I would suggest just asking for more than you want, and limit your loop instead.

    If enough people see it as an issue, I'll look to address it, but I'd need to check how that will affect performance. In the mean time though, the above should be enough to get it working for you.

    Matt

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 18, 2013 @ 12:37
    Dan Diplo
    0

    Hi Matt,

    Thanks for the quick reply! If the problem is with the Twitter API itself then I can see that there is nothing you can do, then.

    I've already basically come to the conclusion you have, so I'm getting five tweets and then in my XSLT I've used:

    <xsl:for-each select="$tweets/status[position()&lt;=2]">

    To just get the first two. (I'm hoping there won't be loads of replies!)

    BTW, noticed another small bug - if a URL is the last part of the tweet then it's not getting "linkified". I'm guessing the regex to "linkify" probaly needs some whitespace after the last character of the URL? I guess just adding a space to the end of the tweet could fix that.

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 18, 2013 @ 12:39
    Matt Brailsford
    0

    Hey Dan,

    Yea, as I say, if enough people see it as an issue too, I might implement something, but I'd prefer to keep close to the API myself.

    Thanks for letting me know about the linking issue, I'll take a look at that when I have a spare few minutes.

    Matt

  • Rob 22 posts 133 karma points
    Mar 07, 2018 @ 18:44
    Rob
    0

    Bringing up an old topic here but I compromised. I called in 20 tweets. Then in the tweet list changed @foreach (var tweet in Model) to @foreach (var tweet in Model.Take(3))

    Seems to work unless there is a load of replies and retweets etc.

Please Sign in or register to post replies

Write your reply to:

Draft