Is there a direct way to check that a user is a friend of friends, i.e. a 2nd degree connection?
For instance you can see from the screenshot that the user is “Followed by Lane Retting, …” which shows that this user is indeed a friend of friends (although I am not following her).
1 Like
No direct way, but - you can get all of your own friends with GET friends/ids | Docs | Twitter Developer Platform and then for each of your friends, use that endpoint to get all of their friend ids. You can cache this and any time you encounter a new user, you can check if their ID is in the collection of your friends of friends.
1 Like
Thanks for the reply!
Surely this is very inefficient if I want to keep the graph up to date, i.e. I would need to query all friends of my friends and check for potential changes?
Is there an efficient way to update friends other than querying the full list again? Is it maybe part of a paid endpoint?
Unfortunately not - there’s no other endpoint for friends and followers - but you can also use friends/list as well as friends/ids to update (the difference is one returns User objects, while the other returns IDs only), and because most ordinary users don’t churn through followers it should only take at most 1 call per user to update their list, because the most recent follows will be in the first “page”.
1 Like
Thanks @IgorBrigadir.
I think Twitter must have a private endpoint to serve the frontend/app with the “Followed by Lane Retting, …” info. I was hoping there was a way to test this without e.g. downloading the html and checking the <div> has text that starts with “Followed by”.
On another note, if a friend is on page 2, then gets unfriended and re-friended again, will it appear now in the first page, or in the same place of page 2? Has anyone tested this?
I’m not 100% sure but i think it’ll appear in the first page, as a new follow.
Hi, you can use the /friendships/show.json entering your friend and then the second user. However a word of caution this end point does have a habit of showing incorrect follower data since May this year. People will show as not following via the end point when they are on the live version of Twitter. The said users also don’t appear in the get friends ID call. Its a strange one but good when it works.
Have a blessed day !
system
Closed
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.