Twitter returns truncated text - twitter

I collected historical twitter data using twitter api ,tweepy for python.But later I realised that twitter truncates the text to 140 chars and to get full text we should use extended mode. With out using extended mode,I learnt that the full text can be extracted for truncated retweeted tweets using retweeted_status field.But is there any way to get full text from truncated tweets which are not retweeted?

Any endpoint that returns Tweets supports the tweet_mode=extended parameter, you can use this to retrieve the full text.

Related

How to find the language of a Tweet using Tweepy?

I gave a stream of Tweets that I filter based on certain criteria. I do not wish to use the language criteria during streaming itself. Rather, I wish to know the language of such filtered tweets.
I'm using Tweepy for streaming. Kindly suggest to me a solution for this.
Status/Tweet objects have a lang attribute. Note though, that it is nullable, meaning it could be None:
When present, indicates a BCP 47 language identifier corresponding to the machine-detected language of the Tweet text, or und if no language could be detected.

iOS Twitter post issue - number of characters

As I know the max length of characters for twitter post is 117. When I post plain text. it's no problem. But when I add a text for hyper link, it will cause problem when I post 117 characters (I can reduce the total length in order to post successfully). Why is like that?
Plain text:
Text with url inside:(this will cause problem even there are 3 characters remains. But if I keep reducing the characters. For example, 10 characters left, then I can post successfully)
Error:
I think the Twitter count algorithm is different from iOS. Any idea? Thanks
I figured it out finally. My conclusion:
The maximum length of twitter text is 140 in web, 117 in iOS if there is no url inside.
The length of each url is 23 no matter original length of the url is. So you have to calculate the maximum length of text allowed by yourself.
Refer to https://github.com/twitter/twitter-text for details although the max length in ObjC is wrong.

Unable to search the non english character in google search appliance (GSA)

We are using google search appliance product in our application. We have added the non English character in Frontend->Keymatch. When we are searching from our site, no result found error page is displayed.
Kindly suggest us to fix this issue.
I guess by saying non english character, you meant the accented characters.
GSA can retrun keymatch results for query terms with accented characters if the query is encoded properly. Encode your query and added ie request parameter with appropriate encoding value.
You can read more about ie and other request parameters here.
You should have added some sample keymatch entry which you configured that would have helped to assist you effectively.

When using SLServiceTypeTwitter, what's the longest a link can be, and how do I format the tweet to make sure it's not longer?

Right now when the user selects an article to share via Twitter, I want to give the link as well as the title of the URL, but I'm having difficulty with figuring out how long link counts for with Twitter.
Are links shared with Twitter via the iOS API counted as the full length of the URL, or where it's a URL, given a special rule/length? If so, how do I calculate the length. I've read a few articles saying links are considered 22 characters long, but that recently changed from 20. What if it changes again?
So how long is a link? And once I figure it out should I just use 140 - link length to figure out how many characters to use for the title?
Per the twitter docs, all URL's are shortened using their t.co service - including those submitted via SLComposeViewController. The docs say that if you attempt to add a long URL to a SLComposeViewController it will succeed or fail based on available space, and that it is the shortened URL that is used when making this decision.
They don't give you a character count but they do tell you if what you're trying to add will fit.
Excerpt from the linked Twitter docs, emphasis mine:
Below is an example of the above steps. Note that the methods for
setting initial content respond with Boolean values; this allows you,
the developer, to not have to worry about the current count of
characters in the body of the Tweet that you are initializing. If the
method returns YES, there was enough room to add the content. If the
method returns NO, the content you attempted to add would result in a
Tweet longer than 140 characters. The logic for character counting
also takes into effect the current number of characters required for
t.co URL wrapping.
I haven't tried but you could likely determine the number of characters available after first adding your URL by iteratively calling setInitialText: with a string with decreasing character count, starting with 140 characters.

Youtube XML search API provides description of the video without any highlight

I am using youtube ATOM xml to retrieve search results related to search terms -
http://gdata.youtube.com/feeds/api/videos?v=2&max-results=10&q=obscure+search+terms&safeSearch=moderate&oi=spell&start-index=1&spell=1
The XML has description for each video but the description does not have any keyword highlighting. For example, if I search for 'soccer', I expect all the word that has 'soccer' in it, to be highlighted by using some tag on the returned XML. Is there any way to get it ?
No, there's not. What does "highlighting" even mean in this context--there's no standard way of representing "highlighting" in XML, so if you're talking about a <b> tag around the search term, that only would be a viable solution for developers who plan on displaying the result in a HTML page. If they did anything else with the result, like display it in a native mobile app, the <b> would be meaningless noise.
In the past, there have been a few instances where search results were being returned with <b> tags around the search terms, but those were bugs, and they all should have been resolved.

Resources