Unable to get the profile URL from User Search


#1

How do I get the profile URLs for each result in a user search?

The following search on Twitter Search
https://twitter.com/search/users?q=seattle%20traffic
returns set of users with Twitter profile URLs

examples:
https://twitter.com/KING5Seattle
https://twitter.com/KIRO7Seattle
https://twitter.com/seattletimes

The following search on API Call
https://api.twitter.com/1.1/users/search.json?q=seattle%20traffic
returns set of users with User destination URLs

examples:
http://t.co/aXNc9dmfDO – redirects to --> http://www.king5.com/
http://t.co/NA38YP3JA7 – redirects to --> http://www.kirotv.com/
http://t.co/vA5IQKRzUl – redirects to --> http://seattletimes.com/html/home/index.html

What is the API call to get the Twitter profile URLs?


#2

The profile URLs themselves aren’t returned in the API. You can build them yourself though, as at this time twitter.com uses this pattern: https://twitter.com/screen_name.

So take the screen_name value from your user response object and attach that to the “https://twitter.com/” url fragment.

The t.co URLs you’re noticing are the user’s self-declared URL associated with their profile.


#3

Hi,

has this changed recently? I am using the Twitter Ruby Gem and when I am accessing User profile urls I always get the profile URLs (twitter.com/screen_name)…

Thanks