0

how to check if the username is available or not in Instagram, i tried using Get request and catch 404 error, it dose not work sometimes, is there another way ? a reliable one?

i tried using object pascal

 try
        lHTTP.Get('http://instagram.com/'+lPath, TStream(nil));
      except
        on E: EIdHTTPProtocolException do
        begin
          if E.ErrorCode = 404 then
          begin
            TThread.Synchronize(nil,
              procedure
              begin
                Form1.Memo2.Lines.Add(lPath);
                 Label2.Text:= IntTosTr(Memo2.Lines.Count);
              end
            );
          end;
          Exit;
        end;
      end;

but sometimes, when it returns 404 i go and check if user exist in instagram, but i cant find it and i cant register with the user, it says user is unavailable!

is there instagram api function that i can use it to check if user is available ? i realised that some accounts are closed! how to differentiate if its closed or taken or available ?

UPDATE

i think maybe this could be answer, but im not sure how to use it in delphi, How do I check if a username is taken with parse.com when all User ACL:Public read/write is disable?

Community
  • 1
  • 1
ColdZer0
  • 233
  • 1
  • 4
  • 19
  • State what you've tried, and why it doesn't work (with code). The public API is the public API. Presumably you used the get by user id. Try the search api. – Dan May 15 '16 at 03:43
  • It is entirely impossible to explain why your code did not work when you do not include the code you used. *I tried, but I'm not going to show the code to you. Explain what I need to change* is not an acceptable question here. *it dose not work sometimes* is not a problem description that is useful (and *dose* is what is used for measuring medications). This site is for **specific questions** about **actual problems**, not *problems that happen sometimes with code I won't share with you*. – Ken White May 15 '16 at 03:47
  • The answer is inactive accounts, and could easily be found with a google search. – Dan May 15 '16 at 03:57
  • dosent matter, is there another way ? @Dan – ColdZer0 May 15 '16 at 04:08
  • 3
    Why don't you try the API? – smooty86 May 15 '16 at 06:54
  • i tried, i tried searching for the username rn0 but didnt find a match !, `https://api.instagram.com/v1/users/search?q=rn0access_tokenxxxxxxxxxxxxxx` i guess its not reliable this way @smooty86 – ColdZer0 May 15 '16 at 07:23
  • The HTTP API call shown in the comment contains errors. Try `https://api.instagram.com/v1/users/search?q=rn0&access_token=xxxxxxxxxxxxxx` – mjn May 15 '16 at 10:41
  • Why oh why oh why won't you use the API? – David Heffernan May 15 '16 at 14:24
  • This is a classic example of refusing to do things the right way and then wondering why it doesn't work as expected. If your car had a flat tire, would you replace it with a bike tire, or the spare tire in your trunk? – Jerry Dodge May 15 '16 at 20:41
  • it will be great if you can tell us how to do it in the right way buddy, because this is my first time working with Instagram api @JerryDodge – ColdZer0 May 15 '16 at 21:46
  • Start by reading the documentation for their API. Then, look for the appropriate tools in Delphi which can work with that API. – Jerry Dodge May 15 '16 at 21:50
  • i read it before, the search api dose not give you the exact username, it give you a list of users that match the username! @JerryDodge – ColdZer0 May 15 '16 at 23:27
  • @ColdZer0 yes, it appears the API uses partial matches... you can reduce your searches to 1 by uses the count parameter. I don't think it's designed to do what you want to do, which is look for usernames that don't exist (possibly for the purpose of creating fake accounts) – John Easley May 16 '16 at 00:21
  • No, its just an app to check available accounts, i think there is still a way cuz there is webistes in the internet for checking available usernames @JohnEasley – ColdZer0 May 16 '16 at 03:06
  • @ColdZer0 I found a question, and the answer says to search, then iterate the results to check for a match http://stackoverflow.com/questions/28444427/check-if-a-user-is-banned-or-account-doesnt-actually-exist-instagram-c-sharp – John Easley May 16 '16 at 03:08
  • but what about the banned and inactive accounts? this methode dose not work everytime @JohnEasley – ColdZer0 May 16 '16 at 04:06

2 Answers2

3

This is very dirty. Complete the code on your own using these instructions

GET this url (to get cookies)

https://www.instagram.com/accounts/web_create_ajax/attempt/

POST to this url again

https://www.instagram.com/accounts/web_create_ajax/attempt/

with these values

  • referer: https://www.instagram.com/
  • new (custom) header named "x-csrftoken", value copy from cookie "csrftoken" which you received from GET

POST values

  • email=... some random e-mail which does not exist on instagram ...
  • password=... some strong password ...
  • username=... your name ...
  • first_name=... empty

You will get result like this if account can be created

{... "status": "ok", "username_suggestions": ["..."], "account_created": false}

or this if not

{..."status": "ok", "username_suggestions": ["..."], "errors": {"username": ["Sorry, that username is taken."]}, "account_created": false}

smooty86
  • 1,112
  • 7
  • 13
0

Your API call example contains errors.

When I try

https://api.instagram.com/v1/users/search?q=rn0&access_token=xxxxxxxxxxxxxx

the server answers

{"meta": {"error_type": "OAuthAccessTokenException", "code": 400, 
  "error_message": "The access_token provided is invalid."}}

As I do not have a access_token, I can't test more than this, but maybe it gets you started

mjn
  • 36,362
  • 28
  • 176
  • 378
  • because your are not supposed to share your access token online!, however the search api dose not give you the exact username, it give you a list of users that matces the username!. – ColdZer0 May 15 '16 at 19:41