Please!
I'm getting tweets from LinqToTwitter, and some tweets seem to have the text truncated, with part of the text following with an ellipsis. In some cases, the search criteria are not returned in the text, as it appears to be in the unearned part of the message. That's right? Is there a way to get this missing part of the message? I have already looked at other posts, but I could not understand which parameter allows the full text to be obtained. I'm using linqToTwitter version 4.1.0.
Thank you
Dim twitterCtx As TwitterContext = New TwitterContext(twAuth)
Dim Response As Search = Await (From search In twitterCtx.Search()
Where search.Type = SearchType.Search _
AndAlso search.SearchLanguage = "pt" _
AndAlso search.Query = "Coronavirus").SingleOrDefaultAsync()
Dim tweets As List(Of Status) = Response.Statuses()
If Response IsNot Nothing AndAlso Response.Statuses IsNot Nothing Then
For Each str As Status In tweets
Console.WriteLine(str.StatusID.ToString() + " " + str.Text)
Next
End If
When Twitter extended tweets from 140 to 280 characters, they needed to add support in the API. This is called Extended Mode
and you need to add a new filter to your LINQ query, like this:
Dim Response As Search = Await (From search In twitterCtx.Search()
Where search.Type = SearchType.Search _
AndAlso search.SearchLanguage = "pt" _
AndAlso search.TweetMode = TweetMode.Extended _
AndAlso search.Query = "Coronavirus").SingleOrDefaultAsync()
Notice the search.TweetMode
property. I assigned the TweetMode.Extended
enum to it, which means you now get the full 280 characters.
Having done that, you might view the Text
property and be surprised to see Nothing
. That's because now the tweet text is in the FullText
property and you can read it like this:
Dim tweets As List(Of Status) = Response.Statuses()
If Response IsNot Nothing AndAlso Response.Statuses IsNot Nothing Then
For Each str As Status In tweets
Console.WriteLine(str.StatusID.ToString() + " " + str.FullText)
Next
End If