CreateTweetWithMedia failed sending an image

Aug 15, 2014 at 11:16 AM
Hi,

sending with CreateTweetWithMedia(text, media) fails on several images. Is there a chance to investigate why this doesn't work?


Best Regards,
Henning
Coordinator
Aug 17, 2014 at 11:36 PM
Hello there,

Sure I can investigate this. But before please be aware that twitter does not allow multiple files to be sent from the Twitter API at current time.
Otherwise please have a look into the Keep In Mind section of the following documentation page of the Twitter API.

If both of these failed please try again and send me the result of the following code:
ExceptionHandler.GetLastException().ToString()
Linvi
Aug 18, 2014 at 2:46 PM
Hi,

I tested a bit more, because there was no exception - just the Publish() function returned "false".

It was simply related to the length of the text: When you include an image to your tweet, you can post 117 instead of 140 characters. But your function "GetRemainingCharacters" does not recognize this. Would be nice to get "-23" if you try to post 140 characters with an image so you can check and change/shorten the text before publishing it.


Best Regards,
Henning
Coordinator
Aug 21, 2014 at 9:23 AM
Hello there,

This issue was already reported and it has already been fixed in the latest version of the Source Code
It will be available as part of Tweetinvi 0.9.4.0.

Linvi
Marked as answer by linvi on 8/21/2014 at 2:23 AM
Aug 22, 2014 at 9:21 AM
Hi there,

thanks for the feedback.

Now I found the reason for my issue: Twitter calculates 22 characters for each link, regardless how long the link is. So the calculation of max tweet lenght is:
140 -22 for each link -23 if image is attached

Will you offer a function to check the text to be twittered so you can shorten it before trying to publish a tweet?



Best Regards,
Henning
Coordinator
Aug 25, 2014 at 11:22 PM
Well you can already just check if the remaining characters is bigger than 0.
if (Tweet.GetTweet(20).TweetRemainingCharacters() < 0)
{
    // The tweet is too big!
}
The hyperlinks are already taken into consideration in previous version of Tweetinvi.

Linvi