Search code examples
jsontwitterjsonptwitter-search

Twitter Search Api Getting Username and User's Real Name


I am trying to develop a twitter search engine by reference of https://dev.twitter.com/docs/api/1/get/search. I am faced to a problem; I searched about it I could not find anything.

$.ajax({
            type : "GET",
            dataType : "json",
            url : "http://search.twitter.com/search.json?q=" +search_value + "&rpp=5&callback=?",
            success: function(data){
                // Display the results

                $("#search_results").html(data);
            }
    });

As you know, twitter api returns a json according your search like in this link "https://dev.twitter.com/docs/api/1/get/search (In the Example Request part)

I need the "username" and the "real name of user" about tweet results, in json format I couldn't see and also I looked https://dev.twitter.com/docs/tweet-entities but there is no tip about this. Only there is "The user_mentions entity", but this users are mentioned in tweet text not about sharer of tweet. Could you help me about this, please?


Solution

  • I recommend that you update your code to use the latest version of the Twitter REST API - version 1.1 as opposed to using the Search API.

    The v1.1 API returns the user's real name in the search/tweets JSON response - see example response here: https://dev.twitter.com/docs/api/1.1/get/search/tweets