Avoiding permalink character count when quoting tweet


#1

Hello,

I’ve developed a simple twitter bot which streams a specific user’s tweets in Arabic, translates it to English using the google translate API. I currently post the translated version on my account, and quote the original Arabic tweet through a permalink that I append to the translated text. Problem is, the permalink is counted in character count, although my understanding is that this should not be the case.
For reference, the status update is used with

api.update_status(status=translatedTweet_txt + mostrecenttweet_url)

where translatedTweet_txt is the string of the English language tweet returned by Google Translate, and mostrecenttweet_url is the permalink of the quoted Arabic language tweet


#2

You’ll need to add the quoted Tweet URL in the attachment_url parameter to have it not counted in the 140 character status text.


#4

Hi Andy - many thanks for the response. Further exploration also allowed me to elicit why i thought some parts of the tweets were being truncated, this was due to me translating retweets of my target user, and this automatically adding the characters “RT :” to the tweet, resulting at times in more than 140 characters.

So as a follow up question, how can I exclude from my bot the retweets my target user is doing? I.e. I should only translate his direct tweets, not his retweets?

Thanks


#5

Assuming you’re using the follow parameter on the streaming API https://dev.twitter.com/streaming/overview/request-parameters#follow the only way for you to do this would be to check whether the Tweet object is a Retweet first and ignore it.