0
votes

I am creating a twitter feed that gets specific hashtag. When im using generic hashtag such as #getaway, the result is fine. But if I use specific hashtag such as #gadgetshow2014, only one tweet appears. When I search from twitter itself there should be a lot of tweets.

Thanks in advance :)

Code:

$consumer_key=' ';
$consumer_secret=' ';  
$access_token=' ';
$access_token_secret=' ';

$hashtag='gadgetshow2014';
$max_tweets = 25;

$twitter = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret);
$url = 'https://api.twitter.com/1.1/search/tweets.json?q=%23' . $hashtag . '&result_type=recent&count=' . $max_tweets . '&include_entities=true';
$tweets = $twitter->get($url);
$tweets = $tweets->statuses;
1
We won't and can't really help you unless you show what code you currently have that's not working. But you're new and didn't read the post guidelines, I get it.Tom
Add it to the main question instead :)Tom
Hi @Svenskunganka, so sorry about that. I have added the code in main question. thanks a lot for your help :)TinTin
You're setting $max_tweets = 25;, how many do you get?Tom
@Svenskunganka only one tweet for #gadgetshow2014.. I also tried twitter widget and the same result appears.TinTin

1 Answers

0
votes

Sadly, you've run in to one of the many artificial restriction on the Twitter API.

Please note that Twitter’s search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface. https://dev.twitter.com/rest/reference/get/search/tweets

You can try using the max_id parameter to get older Tweets - but it is unlikey to have any effect.