예제 #1
0
        public async void Start()
        {
            foreach (var u in mUsers)
            {
                var userSession = new UserSessionData
                {
                    UserName = u.Username,
                    Password = u.Password
                };
                var api = new InstaApiBuilder()
                          .SetUser(userSession)
                          .Build();
                var logInResult = await api.LoginAsync();

                if (!logInResult.Succeeded)
                {
                    if (logInResult.Info.ResponseType == ResponseType.CheckPointRequired)
                    {
                        Console.WriteLine($"Unable to login: CheckPoint Required");
                    }
                    else if (logInResult.Info.ResponseType == ResponseType.Unknown)
                    {
                        Console.WriteLine($"Unable to login: {logInResult.Info.Message}");
                    }
                    else if (logInResult.Info.ResponseType == ResponseType.RequestsLimit)
                    {
                        Console.WriteLine($"Unable to login: Rate Limit");
                        Environment.Exit(-10);
                    }
                }
                else
                {
                    try
                    {
                        var user = await api.GetCurrentUserAsync();

                        var state = await api.FollowUserAsync(mTarget);

                        if (state.Succeeded == true)
                        {
                            Console.WriteLine($"{user.Value.UserName} followed!");
                        }
                        else
                        {
                            Console.WriteLine("Failed To Follow :(");
                        }
                        await Task.Delay(mDelay);
                    }
                    catch (Exception er)
                    {
                    }
                }
                await Task.Delay(mDelay);
            }
            Environment.Exit(0);
        }