Tweet objects - hashtags: Hashtags found in tweet body (text) but entities.hashtags array is empty - is there a right case?


#1

The tweet is returned inside an API search query with #myhashtag operator but no hashtags in entities meta-data

...
"entities": {
    "hashtags": [
    ],
...

Just an empty array - but the hashtags should have been parsed from tweet body text containing #myhashtag?!


#2

Does the Tweet also contain the value truncated: true? if so, you have an extended Tweet, and need to retrieve it using ?tweet_mode=extended in order to get the full data object.


#3

Many thanks for your very fast response!

I tried this with using twitter4j.

Unfortunately nothing changed. The tag is still not in hashtags array of the containing tweet from search result for this hashtag - what is a bit weird.

Finally I worked around it by adding my searched for hashtag to hashtags array myself afterwards.


#4

This is most definitely a bug with the library you are using.
I’ve never once seen a mistake or bug with the hashtag arrays assumed extended mode is on.


#5

Why wouldn’t you just update to a newer version of Twitter4J that supports extended mode? That would be better, as if you’re not consuming the extended version of the Tweet, you’ll also miss other entities like URLs, media, and the rest of the text (full_text).


#6

I already updated to Twitter4j latest version before - in a way shown in last comment on above githubgist page.

twitter4j.conf.ConfigurationBuilder()
      .setOAuthConsumerKey(""))
      .setOAuthConsumerSecret("")
      .setOAuthAccessToken("")
      .setOAuthAccessTokenSecret("")
      .setTweetModeExtended(true)

With extended mode it seems to be better but still sometimes the hashtags array is empty or #myhashtag is missing. But you are right - I reckon it is from the library through-put and not from twitter search API…

I am satisfied by re-adding #myhashtag afterwards if missing in hashtags array.
Thank you even though…


#7

You might want to consider applying for a developer account so you can access our newer premium Search API.