Is it possible using the Twitter API to retrieve a list of all hashtags present within a single tweet?
For example, let\'s say I have a tweet (let\'s say it has an I
Although @ialphan's solution is good, if you want to sort hashtags with occurance just use this answer in similar question:
Retrieve all hashtags from a tweet in a PHP function
You can use Tweet Entities. Just include &include_entities=1
.
The Twitter API does not have any functions specifically designed for hashtags. You'll need to parse the text on your own.
You'll have to use a regular expression in your language of choice
#\S+
should match any hash, beginning with # and made of a string of characters. It stops at the first space.
If you want to exclude any trailing symbol and have a letter as the last char :
#\S*\w
This expression should work in most of the regex engines I'm aware of.