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


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?!


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.


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.


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.


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).


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


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…


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


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.