Get '/search/tweets' giving empty statuses for specific since and max ids

search
api

#1

Hi all,

I’m using the ‘/search/tweets’ endpoint to get data for the search term " ASTRO ".
I’m getting and empty array in the statuses field for the request below.

Request JSON:
{“statuses”:[],“search_metadata”:{“completed_in”:0.006,“max_id”:628030574318350336,“max_id_str”:“628030574318350336”,“query”:"%22ASTRO%22",“refresh_url”
:"?since_id=628030574318350336&q=%22ASTRO%22&include_entities=1",“count”:100,“since_id”:627862121250881530,“since_id_str”:“627862121250881530”}}

When i use a different since id and max id, i do get a response.

Request JSON for different since and max id:
{“statuses”:[{“metadata”:{“iso_language_code”:“en”,“result_type”:“recent”},“created_at”:“Wed Aug 12 03:24:14 +0000 2015”,“id”:631305162125017088,“id_str”:“631305162125017088”,“text”:“RT @Twt_ArsenalMY: Next Match: Cystal Palace v Arsenal (GW2)\nTime: 2030 (Msia Time) \nDate: 16/08/2015 \nVenue: Selhurst Park Stadium \nLive o\u2026”,“source”:"<a href=“http://twitter.com/download/android” rel=“nofollow”>Twitter for Android</a>",“truncated”:false,“in_reply_to_status_id”:null,“in_reply_to_status_id_str”:null,“in_reply_to_user_id”:null,“in_reply_to_user_id_str”:null,“in_reply_to_screen_name”:null,“user”:{“id”:213983304,“id_str”:“213983304”,“name”:“Ejat A.”,“screen_name”:“ejtadnn”,“location”:"",“description”:“Do something.\nWork on something.\nBelieve something.\nFor your FAMILY.”,“url”:null,“entities”:{“description”:{“urls”:[]}},“protected”:false,“followers_count”:270,“friends_count”:339,“listed_count”:1,“created_at”:“Wed Nov 10 08:03:19 +0000 2010”,“favourites_count”:2890,“utc_offset”:28800,“time_zone”:“Kuala Lumpur”,“geo_enabled”:true,“verified”:false,“statuses_count”:27596,“lang”:“en”,“contributors_enabled”:false,“is_translator”:false,“is_translation_enabled”:false,“profile_background_color”:“000000”,“profile_background_image_url”:“http://pbs.twimg.com/profile_background_images/232855505/blue-and-green-emo.jpg",“profile_background_image_url_https”:“https://pbs.twimg.com/profile_background_images/232855505/blue-and-green-emo.jpg”,“profile_background_tile”:true,“profile_image_url”:“http://pbs.twimg.com/profile_images/631059822654259201/saBL32lA_normal.jpg”,“profile_image_url_https”:“https://pbs.twimg.com/profile_images/631059822654259201/saBL32lA_normal.jpg”,“profile_banner_url”:“https://pbs.twimg.com/profile_banners/213983304/1438102103”,“profile_link_color”:“0084B4”,“profile_sidebar_border_color”:“FFFFFF”,“profile_sidebar_fill_color”:“DDEEF6”,“profile_text_color”:“333333”,“profile_use_background_image”:false,“has_extended_profile”:false,“default_profile”:false,“default_profile_image”:false,“following”:false,“follow_request_sent”:false,“notifications”:false},“geo”:null,“coordinates”:null,“place”:null,“contributors”:null,“retweeted_status”:{“metadata”:{“iso_language_code”:“en”,“result_type”:“recent”},“created_at”:"Wed Aug 12 03:04:47 +0000 2015”,“id”:631300267456081921,“id_str”:“631300267456081921”,“text”:“Next Match: Cystal Palace v Arsenal (GW2)\nTime: 2030 (Msia Time) \nDate: 16/08/2015 \nVenue: Selhurst Park Stadium \nLive on Astro 812/832 HD”,“source”:"<a href=“http://twitter.com/download/iphone” rel=“nofollow”>Twitter for iPhone</a>",“truncated”:false,“in_reply_to_status_id”:null,“in_reply_to_status_id_str”:null,“in_reply_to_user_id”:null,“in_reply_to_user_id_str”:null,“in_reply_to_screen_name”:null,“user”:{“id”:1275438780,“id_str”:“1275438780”,“name”:“TwtArsenalMY”,“screen_name”:“Twt_ArsenalMY”,“location”:“Malaysia”,“description”:“News about Arsenal. Match schedules at Favourites tab. From Gooners to Gooners. FPL Code: 749053-5612”,“url”:“http://t.co/mTwGas62iH",“entities”:{“url”:{“urls”:[{“url”:“http://t.co/mTwGas62iH”,“expanded_url”:“http://ask.fm/twt_arsenalMy”,“display_url”:“ask.fm/twt_arsenalMy”,“indices”:[0,22]}]},“description”:{“urls”:[]}},“protected”:false,“followers_count”:4310,“friends_count”:260,“listed_count”:24,“created_at”:"Sun Mar 17 16:51:38 +0000 2013”,“favourites_count”:53,“utc_offset”:28800,“time_zone”:“Kuala Lumpur”,“geo_enabled”:true,“verified”:false,“statuses_count”:47191,“lang”:“en”,“contributors_enabled”:false,“is_translator”:false,“is_translation_enabled”:true,“profile_background_color”:“ABB8C2”,“profile_background_image_url”:“http://pbs.twimg.com/profile_background_images/562142149089566722/5d2UQt_x.png",“profile_background_image_url_https”:“https://pbs.twimg.com/profile_background_images/562142149089566722/5d2UQt_x.png”,“profile_background_tile”:false,“profile_image_url”:“http://pbs.twimg.com/profile_images/629861888516468736/n3WjLNv-_normal.jpg”,“profile_image_url_https”:“https://pbs.twimg.com/profile_images/629861888516468736/n3WjLNv-normal.jpg”,“profile_banner_url”:“https://pbs.twimg.com/profile_banners/1275438780/1439004633”,“profile_link_color”:“DD2E44”,“profile_sidebar_border_color”:“C0DEED”,“profile_sidebar_fill_color”:“DDEEF6”,“profile_text_color”:“333333”,“profile_use_background_image”:true,“has_extended_profile”:true,“default_profile”:false,“default_profile_image”:false,“following”:false,“follow_request_sent”:false,“notifications”:false},“geo”:null,“coordinates”:null,“place”:null,“contributors”:null,“is_quote_status”:false,“retweet_count”:13,“favorite_count”:7,“entities”:{“hashtags”:[],“symbols”:[],“user_mentions”:[],“urls”:[]},“favorited”:false,“retweeted”:false,“lang”:“en”},“is_quote_status”:false,“retweet_count”:13,“favorite_count”:0,“entities”:{“hashtags”:[],“symbols”:[],“user_mentions”:[{“screen_name”:“Twt_ArsenalMY”,“name”:"TwtArsenalMY “,“id”:1275438780,“id_str”:“1275438780”,“indices”:[3,17]}],“urls”:[]},“favorited”:false,“retweeted”:false,“lang”:“en”}],“search_metadata”:{“completed_in”:0.014,“max_id”:631305162125017088,“max_id_str”:“631305162125017088”,“query”:”%22%2BASTRO%2B%22”,“refresh_url”:"?since_id=631305162125017088&q=%22%2BASTRO%2B%22&include_entities=1",“count”:100,“since_id”:631305130625794048,“since_id_str”:“631305130625794048”}}

Am i getting empty statuses because there’s no tweets for that search term between those ids?

Thank you.

p.s. Sorry for the color change in text. I couldn’t figure out how to change it back.


#2

I’m confused it looks like your max_id is the same as since_id and that will not work. since_id is > and max_id is >= which is essentially if(id > 628030574318350336 && id >= 628030574318350336) return; (according to the docs)


#3

Hi Trace,

I passed in since_id = 627862121250881530 and max id = 628030574318350336

{“statuses”:[],“search_metadata”:{“completed_in”:0.006,“max_id”:628030574318350336,“max_id_str”:“628030574318350336”,“query”:"%22ASTRO%22",“refresh_url”:"?since_id=628030574318350336&q=%22ASTRO%22&include_entities=1",“count”:100,“since_id”:627862121250881530,“since_id_str”:“627862121250881530”}}

I think you are refering to the since_id reflected in refresh_url. That parameter isn’t set by me. It’s set by twitter in the response.


#4

Not exactly sure what’s going on but it might be because there’s no tweet with the id: 627862121250881530 (your since_id).