0
votes

I need API which can provide me userid from facebook profile url. Eg: https://www.facebook.com/bhupinder.rajput.786 This is my profile url but when I hit this (https://graph.facebook.com/v2.5/bhupinder.singh.rajput) url in Graph API But I get error response

{ "error": { "message": "(#803) Cannot query users by their user name (bhupinder.rajput.786)", "type": "OAuthException", "code": 803, "fbtrace_id": "ChRSh/G8Q0J" } }

Then I try to scrap this url to get userid from Html source but when I hit this url I am getting response in Punjabi language.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URI);
            HttpWebResponse requestp = (HttpWebResponse)request.GetResponse();

            StreamReader streamReader = new StreamReader(requestp.GetResponseStream(), Encoding.ASCII);
            SourceCode = streamReader.ReadToEnd();
            SourceCode = HttpUtility.HtmlDecode(SourceCode);
            requestp.Close();
1
Facebook forbids scraping via its TOS: facebook.com/apps/site_scraping_tos_terms.phpTobi

1 Answers

0
votes

Since Graph API v2.0 (1.5 years ago!), it's no longer possible to use the username field and match this to the global Facebook user id.

Now, all apps have to use the app-scoped user id. If you'd use Facebook Login, this would be not a problem.

See