コード例 #1
0
        static public IInstaApi BuildApi(string username = null, string password = null)
        {
            var fakeUserData = UserSessionData.ForUsername(username ?? "FAKEUSER").WithPassword(password ?? "FAKEPASS");

            return(InstaApiBuilder.CreateBuilder()
                   .SetUser(fakeUserData)
                   .Build());
        }
コード例 #2
0
        public void CreateApiInstanceWithBuilder()
        {
            var result = InstaApiBuilder.CreateBuilder()
                         .UseLogger(new DebugLogger(LogLevel.All))
                         .Build();

            Assert.NotNull(result);
        }
コード例 #3
0
ファイル: LoginViewModel.cs プロジェクト: sadboykaka/Winsta
        private async void LoginAskSessionAsync()
        {
            try
            {
                var exists = await SessionHelper.IsBackupSessionAvailable(UserName);

                if (exists)
                {
                    var content = $"It seems you stored session for '{UserName}' account.\r\n" +
                                  $"Do you want to use this session?\r\n" +
                                  $"Press 'No' if you want to create new session.";
                    var md = new MessageDialog(content);
                    md.Commands.Add(new UICommand("Yes"));
                    md.Commands.Add(new UICommand("No"));
                    md.CancelCommandIndex  = 1;
                    md.DefaultCommandIndex = 1;

                    var label = await md.ShowAsync();

                    if (label.Label == "Yes")
                    {
                        var json = await SessionHelper.GetBackupSession(UserName);

                        string User = "******"; string Pass = "******";
                        AppCore.InstaApi = InstaApiBuilder.CreateBuilder()
                                           .SetUser(new UserSessionData {
                            UserName = User, Password = Pass
                        })
                                           .UseLogger(new DebugLogger(LogLevel.Exceptions))
                                           .Build();
                        AppCore.InstaApi.LoadStateDataFromStream(json);
                        if (!AppCore.InstaApi.IsUserAuthenticated)
                        {
                            await AppCore.InstaApi.LoginAsync();
                        }
                        await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate
                        {
                            AppCore.SaveUserInfo(UserName, Password);
                            MainPage.MainFrame.Navigate(typeof(MainView));
                        });
                    }
                    else
                    {
                        await SessionHelper.DeleteBackupSession(UserName);

                        LoginAsync();
                    }
                }
                else
                {
                    LoginAsync();
                }
            }
            catch
            {
                LoginAsync();
            }
        }
コード例 #4
0
        /// <summary>
        /// Insta Giriş Yapma
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_InstaGirisYap_Click(object sender, EventArgs e)
        {
            // Session Başlatma
            var userSession = new UserSessionData
            {
                UserName = textBox_InstaGiris_kadi.Text,
                Password = textBox_InstaGiris_Sifre.Text
            };

            string StateYol = StateFile;

            // dosya var mı kontrol et varsa eğer sil
            if (File.Exists(StateYol))
            {
                File.Delete(StateYol);
            }

            // Oturum oluşturma
            InstaApi = InstaApiBuilder.CreateBuilder()
                       .SetUser(userSession)
                       .SetRequestDelay(RequestDelay.FromSeconds(0, 1))
                       .SetSessionHandler(new FileSessionHandler()
            {
                FilePath = StateYol
            })
                       .Build();
            LoadSession();


            // Giriş kontrolü
            if (!InstaApi.IsUserAuthenticated)
            {
                // Başarısız

                // Giriş çıktısı
                var logInResult = await InstaApi.LoginAsync();

                // Başarılı mı?
                if (logInResult.Succeeded)
                {
                    // Bilgi Mesajı
                    BilgiMesaji("basarili", "Giriş yapıldı.", this.Text, true);
                    SaveSession();
                }
                else
                {
                    // Bilgi Mesajı
                    BilgiMesaji("basarili", "Giriş yapılamadı.", this.Text, true);
                }
            }
            else
            {
                // Bilgi Mesajı
                BilgiMesaji("basarili", "Giriş yapıldı.", this.Text, true);
                SaveSession();
            }
        }
コード例 #5
0
        public static async Task <List <Tuple <InstaMedia, BotConfigFile_SocialAccount> > > GetNewPosts(SocialStreamPointSaved saved)
        {
            //Login and create the API wrapper
            var api = InstaApiBuilder.CreateBuilder().SetUser(new InstagramApiSharp.Classes.UserSessionData
            {
                UserName = Program.config.instagram_auth.username,
                Password = Program.config.instagram_auth.password
            }).Build();
            var logInResult = await api.LoginAsync();

            //Find new posts
            List <Tuple <InstaMedia, BotConfigFile_SocialAccount> > newPosts = new List <Tuple <InstaMedia, BotConfigFile_SocialAccount> >();

            foreach (var account in Program.config.social_pages)
            {
                if (account.platform != BotConfigFile_SocialAccountType.Instagram)
                {
                    continue;
                }

                //Fetch posts
                var userMedias = await api.UserProcessor.GetUserMediaAsync(account.username, InstagramApiSharp.PaginationParameters.MaxPagesToLoad(1));

                //Get the saved data from the stream, if we have it
                DateTime lastTime = DateTime.MinValue;
                if (saved.instagram_latest_post_time.ContainsKey(account.username))
                {
                    lastTime = saved.instagram_latest_post_time[account.username];
                }
                DateTime checkTime = lastTime.AddSeconds(10); //Rounding protection. Not sure if it's actually needed.

                //We know that the latest posts are first, so go through until we get the last post that was sent.
                for (int i = 0; i < userMedias.Value.Count; i += 1)
                {
                    var media = userMedias.Value[i];
                    if (media.TakenAt > checkTime)
                    {
                        newPosts.Add(new Tuple <InstaMedia, BotConfigFile_SocialAccount>(media, account));
                    }
                }

                //Update the last time
                if (userMedias.Value.Count >= 1)
                {
                    if (saved.instagram_latest_post_time.ContainsKey(account.username))
                    {
                        saved.instagram_latest_post_time[account.username] = userMedias.Value[0].TakenAt;
                    }
                    else
                    {
                        saved.instagram_latest_post_time.Add(account.username, userMedias.Value[0].TakenAt);
                    }
                }
            }

            return(newPosts);
        }
コード例 #6
0
        private async void LoginButton_Click(object sender, EventArgs e)
        {
            Size = NormalSize;
            var userSession = new UserSessionData
            {
                UserName = txtUsername.Text,
                Password = txtPassword.Text
            };

            InstaApi = InstaApiBuilder.CreateBuilder()
                       .SetUser(userSession)
                       .UseLogger(new DebugLogger(LogLevel.Exceptions))
                       .SetRequestDelay(RequestDelay.FromSeconds(0, 1))
                       .Build();
            Text = $"{AppName} Connecting";
            try
            {
                if (File.Exists(StateFile))
                {
                    Debug.WriteLine("Loading state from file");
                    using (var fs = File.OpenRead(StateFile))
                    {
                        InstaApi.LoadStateDataFromStream(fs);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }

            if (!InstaApi.IsUserAuthenticated)
            {
                var logInResult = await InstaApi.LoginAsync();

                Debug.WriteLine(logInResult.Value);
                if (logInResult.Succeeded)
                {
                    Text = $"{AppName} Connected";
                    // Save session
                    SaveSession();
                }
                else
                {
                    // two factor is required
                    if (logInResult.Value == InstaLoginResult.TwoFactorRequired)
                    {
                        // open a box so user can send two factor code
                        Size = TwoFactorSize;
                    }
                }
            }
            else
            {
                Text = $"{AppName} Connected";
            }
        }
コード例 #7
0
        public static IInstaApi GetDefaultInstaApiInstance(UserSessionData user)
        {
            var apiInstance = InstaApiBuilder.CreateBuilder()
                              .SetUser(user)
                              .SetRequestDelay(TimeSpan.FromSeconds(5))
                              .Build();

            return(apiInstance);
        }
コード例 #8
0
        protected void LikeButton_Click1(object sender, EventArgs e)
        {
            string url = UrlText.Text;

            long   id = shortcodeToInstaID(url);
            string Id = id.ToString();

            LikeButton.Text = Id;

            DataTable dt = new DataTable();

            dt = db.Fill("select * from Userstbl ");


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var userSession = new UserSessionData
                {
                    UserName = dt.Rows[i]["Username"].ToString(),
                    Password = dt.Rows[i]["Password"].ToString()
                };


                var delay = RequestDelay.FromSeconds(2, 2);
                ınstagramApi = InstaApiBuilder.CreateBuilder()
                               .SetUser(userSession)
                               .UseLogger(new DebugLogger(LogLevel.Exceptions)) // use logger for requests and debug messages
                               .SetRequestDelay(delay)
                                                                                //.SetDevice(androidDevice);
                               .SetSessionHandler(new FileSessionHandler()
                {
                    FilePath = StateFile
                })
                               .Build();
                var r = Task.Run(() => ınstagramApi.LoginAsync());
                if (r.Result.Succeeded)
                {
                    LikeButton.Text = "Login";
                }


                //    var z = Task.Run(() => ınstagramApi.MediaProcessor.GetMediaIdFromUrlAsync(uri));

                //    string ID = z.Result.Value;

                //string id = "2372503629901614370";

                var x = Task.Run(() => ınstagramApi.MediaProcessor.LikeMediaAsync(Id));

                //if (x.Result.Succeeded)
                //{
                //    LikeButton.Text = "Liked Successfully";
                //}
            }
            //LoadSession();
        }
コード例 #9
0
ファイル: InstApiFactory.cs プロジェクト: andrew-v-2019/VkApi
        public async Task <IInstaApi> Login()
        {
            var userName = ConfigurationManager.AppSettings["InstUserName"];
            var pass     = ConfigurationManager.AppSettings["InstPassword"];

            var userSession = new UserSessionData
            {
                UserName = userName,
                Password = pass
            };

            var instaApi = InstaApiBuilder.CreateBuilder()
                           .SetUser(userSession)
                           .UseLogger(new DebugLogger(LogLevel.Exceptions))
                           .Build();
            const string stateFile = "state.bin";

            try
            {
                if (File.Exists(stateFile))
                {
                    Console.WriteLine("Loading state from file");
                    using (var fs = File.OpenRead(stateFile))
                    {
                        await instaApi.LoadStateDataFromStreamAsync(fs);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (!instaApi.IsUserAuthenticated)
            {
                // login
                Console.WriteLine($"Logging in as {userSession.UserName}");
                var logInResult = await instaApi.LoginAsync();

                if (!logInResult.Succeeded)
                {
                    Console.WriteLine($"Unable to login: {logInResult.Info.Message}");
                    return(instaApi);
                }
            }

            var state = await instaApi.GetStateDataAsStreamAsync();

            using (var fileStream = File.Create(stateFile))
            {
                state.Seek(0, SeekOrigin.Begin);
                await state.CopyToAsync(fileStream);
            }

            return(instaApi);
        }
コード例 #10
0
ファイル: program.cs プロジェクト: BodiKBorN/InstaBot
 private static IInstaApi BuildInstaApi(string userName, string password)
 => InstaApiBuilder
 .CreateBuilder()
 .UseLogger(new DebugLogger(LogLevel.All))
 .SetUser(new UserSessionData
 {
     UserName = userName,
     Password = password
 })
 .Build();
コード例 #11
0
        /// <summary>
        /// Load the InstaAPI
        /// </summary>
        public void InitializeAPI()
        {
            //Create the instaApi object:
            instaApi = InstaApiBuilder.CreateBuilder()
                       .UseLogger(new DebugLogger(LogLevel.Exceptions))
                       .Build();

            // Set the Android Device:
            //instaApi.SetDevice(InstagramProcessor.device);
        }
コード例 #12
0
        public async void rememberLogin()
        {
            try
            {
                if (File.Exists(startupPath2 + "//user.txt") == true && File.Exists(startupPath2 + "//pass.txt") == true)
                {
                    loginStatus.Text = "Logging...";
                    var userSession = new UserSessionData
                    {
                        UserName = File.ReadAllText(startupPath2 + "//user.txt"),
                        Password = File.ReadAllText(startupPath2 + "//pass.txt"),
                    };
                    InstaApi = InstaApiBuilder.CreateBuilder()
                               .SetUser(userSession)
                               .UseLogger(new DebugLogger(LogLevel.All))
                               .Build();

                    var loginResult = await InstaApi.LoginAsync();

                    if (loginResult.Succeeded == true)
                    {
                        loginStatus.ForeColor = Color.DarkGreen;
                        btnLogout.Enabled     = true;
                        loginStatus.Text      = "Succeess";
                    }
                    else if (loginResult.Value.ToString() == "ChallengeRequired")
                    {
                        MessageBox.Show("ChallengeRequired please try to login again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        File.Delete(startupPath2 + "//user.txt");
                        File.Delete(startupPath2 + "//pass.txt");
                        btnLogout.Enabled = false;
                        loginStatus.Text  = "Not Login";
                    }
                    else if (loginResult.Value.ToString() == "Invalid User")
                    {
                        File.Delete(startupPath2 + "//user.txt");
                        File.Delete(startupPath2 + "//pass.txt");
                        MessageBox.Show("Invalid User please try to login again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        btnLogout.Enabled = false;
                        loginStatus.Text  = "Not Login";
                    }
                }

                else
                {
                    loginStatus.Text  = "Not Login";
                    btnLogout.Enabled = false;
                }
            }
            catch
            {
                loginStatus.ForeColor = Color.Red;
                loginStatus.Text      = "Connection Faild";
            }
        }
コード例 #13
0
        //登录账号
        public static async System.Threading.Tasks.Task InsLoginAsync()
        {
            #region 登录Ins
            Console.WriteLine("登录Ins...");
            var userSession = new UserSessionData
            {
                UserName = "******",
                Password = "******"
            };

            var delay = RequestDelay.FromSeconds(2, 2);
            InstaApi = InstaApiBuilder.CreateBuilder()
                       .SetUser(userSession)
                       .UseLogger(new DebugLogger(LogLevel.All))
                       .SetRequestDelay(delay)
                       .Build();
            const string stateFile = "state.bin";
            try
            {
                if (System.IO.File.Exists(stateFile))
                {
                    Console.WriteLine("从文件加载登录.");
                    using (var fs = System.IO.File.OpenRead(stateFile))
                    {
                        InstaApi.LoadStateDataFromStream(fs);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (!InstaApi.IsUserAuthenticated)
            {
                // login
                Console.WriteLine($"Logging in as {userSession.UserName}");
                delay.Disable();
                var logInResult = await InstaApi.LoginAsync();

                delay.Enable();
                if (!logInResult.Succeeded)
                {
                    Console.WriteLine($"Unable to login: {logInResult.Info.Message}");
                }
            }
            var state = InstaApi.GetStateDataAsStream();
            using (var fileStream = System.IO.File.Create(stateFile))
            {
                state.Seek(0, SeekOrigin.Begin);
                state.CopyTo(fileStream);
            }
            Console.WriteLine("已登录");
            #endregion
        }
コード例 #14
0
        public static async Task <bool> LoadAndLogin()
        {
            if (!File.Exists(SessionPath))
            {
                return(false);
            }
            try
            {
                var userSession = new UserSessionData
                {
                    UserName = "******",
                    Password = "******"
                };
                if (Helper.Settings != null && Helper.Settings.UseProxy && !string.IsNullOrEmpty(Helper.Settings.ProxyIP) && !string.IsNullOrEmpty(Helper.Settings.ProxyPort))
                {
                    var proxy = new WebProxy()
                    {
                        Address               = new Uri($"http://{Helper.Settings.ProxyIP}:{Helper.Settings.ProxyPort}"),
                        BypassProxyOnLocal    = false,
                        UseDefaultCredentials = false,
                    };
                    var httpClientHandler = new HttpClientHandler()
                    {
                        Proxy = proxy,
                    };
                    Helper.InstaApi = InstaApiBuilder.CreateBuilder()
                                      .SetUser(userSession)
                                      .UseLogger(new DebugLogger(LogLevel.Exceptions))
                                      .UseHttpClientHandler(httpClientHandler)
                                      .Build();
                }
                else
                {
                    Helper.InstaApi = InstaApiBuilder.CreateBuilder()
                                      .SetUser(userSession)
                                      .UseLogger(new DebugLogger(LogLevel.Exceptions))
                                      .Build();
                }
                var text = LoadSession();
                Helper.InstaApi.LoadStateDataFromString(text);
                if (!Helper.InstaApi.IsUserAuthenticated)
                {
                    await Helper.InstaApi.LoginAsync();
                }

                $"Us: {Helper.InstaApi.GetLoggedUser().UserName}".Output();
                return(true);
            }
            catch (Exception ex)
            {
                ex.PrintException("LoadAndLogin");
                Helper.InstaApi = null;
            }
            return(false);
        }
コード例 #15
0
 private void CreateInstaApi(string userName, string password)
 {
     _instaApi = InstaApiBuilder.CreateBuilder()
                 .SetRequestDelay(RequestDelay.FromSeconds(1, 2))
                 .SetUser(new UserSessionData
     {
         UserName = userName,
         Password = password
     })
                 .Build();
 }
コード例 #16
0
        public static async Task Worker(string login, string password, string mail, string proxy, string name)
        {
            HttpClientHandler handler = new HttpClientHandler
            {
                Proxy    = new WebProxy(proxy),
                UseProxy = true
            };

            var userSession = new UserSessionData
            {
                UserName = SessionLog,
                Password = SessionPwd
            };

            HttpClient cl = new HttpClient(handler);


            cl.DefaultRequestHeaders.Add("User-Agent",
                                         "Mozilla/5.0 (Linux; U; Android 2.2) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");

            IInstaApi instaApi = InstaApiBuilder.CreateBuilder()
                                 .SetUser(userSession)
                                 .UseHttpClientHandler(handler)
                                 .UseHttpClient(cl)
                                 .Build();


            try
            {
                var nd = await instaApi.CreateNewAccount(login, password, mail,
                                                         name);


                switch (nd.Info.Message)
                {
                case "feedback_required":
                    Console.WriteLine("Ban account!");
                    break;

                case "No errors detected":
                    CreationResponse ni1 = nd.Value;
                    Console.WriteLine("Created: " + ni1.AccountCreated);
                    break;

                default:
                    Console.WriteLine(nd.Info.Message);
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #17
0
        private static IInstaApi CreateInstaApi(byte[] cookies, int requestDelayMin, int requestDelayMax)
        {
            IRequestDelay delay = RequestDelay.FromSeconds(requestDelayMin, requestDelayMax);

            var instaAPI = InstaApiBuilder.CreateBuilder()
                           .SetRequestDelay(delay)
                           .Build();

            instaAPI.LoadStateDataFromStream(new MemoryStream(cookies));

            return(instaAPI);
        }
コード例 #18
0
        public InstagramService(IOptions <InstagramOptions> options)
        {
            UserSessionData userSession = new UserSessionData
            {
                UserName = options.Value.Username,
                Password = options.Value.Password
            };

            _instaApi = InstaApiBuilder.CreateBuilder()
                        .SetUser(userSession)
                        .Build();
        }
コード例 #19
0
        public static async void UploadPhoto(string path)
        {
            const string stateFile = "state.bin";

            var userSession = new UserSessionData
            {
                UserName = File.ReadAllLines("LoginInfo.txt")[0],
                Password = File.ReadAllLines("LoginInfo.txt")[1]
            };

            Console.WriteLine("Initializing API");

            _instaApi = InstaApiBuilder.CreateBuilder()
                        .SetUser(userSession)
                        .UseLogger(new DebugLogger(LogLevel.Exceptions))
                        .SetRequestDelay(TimeSpan.FromSeconds(2))
                        .Build();

            Console.WriteLine($"Logging into {userSession.UserName}");

            var logInResult = await _instaApi.LoginAsync();

            if (!logInResult.Succeeded)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Login failed => {logInResult.Info.Message}");
                return;
            }
            else
            {
                Console.WriteLine("Login successfull");
            }

            var state = _instaApi.GetStateDataAsStream();

            using (var fileStream = File.Create(stateFile))
            {
                state.Seek(0, SeekOrigin.Begin);
                state.CopyTo(fileStream);
            }

            Console.WriteLine("API initialized succesfully ");

            var upl = new UploadPhoto(_instaApi);

            Console.WriteLine("Press ENTER and type optional caption (leave blank if undesired)");

            string caption = Console.ReadLine();

            Console.WriteLine($"Uploading with caption {caption}");

            await upl.UploadImg(caption, path);
        }
コード例 #20
0
        public static IInstaApi GetProxifiedInstaApiInstance(UserSessionData user, InstaProxy proxy)
        {
            var handler = new HttpClientHandler {
                Proxy = proxy
            };
            var apiInstance = InstaApiBuilder.CreateBuilder()
                              .UseHttpClientHandler(handler)
                              .SetUser(user)
                              .Build();

            return(apiInstance);
        }
コード例 #21
0
        public static IInstaApi GetDefaultInstaApiInstance(UserSessionData user)
        {
            var device         = AndroidDeviceGenerator.GetByName(AndroidDevices.SAMSUNG_NOTE3);
            var requestMessage = ApiRequestMessage.FromDevice(device);
            var apiInstance    = InstaApiBuilder.CreateBuilder()
                                 .SetUser(user)
                                 .SetApiRequestMessage(requestMessage)
                                 .SetRequestDelay(TimeSpan.FromSeconds(2))
                                 .Build();

            return(apiInstance);
        }
コード例 #22
0
        public static IInstaApi GetDefaultInstaApiInstance(string username)
        {
            var device         = AndroidDeviceGenerator.GetByName(AndroidDevices.SAMSUNG_NOTE3);
            var requestMessage = ApiRequestMessage.FromDevice(device);
            var apiInstance    = InstaApiBuilder.CreateBuilder()
                                 .SetUserName(username)
                                 .UseLogger(new DebugLogger(LogLevel.All))
                                 .SetApiRequestMessage(requestMessage)
                                 .Build();

            return(apiInstance);
        }
コード例 #23
0
ファイル: Account.cs プロジェクト: chernyshvova/Insta
 public Account(UserSessionData userSession)
 {
     this.userSession = userSession;
     InstaApi         = InstaApiBuilder.CreateBuilder()
                        .SetUser(userSession)
                        .UseLogger(new DebugLogger(LogLevel.All))        // use logger for requests and debug messages
                        .SetRequestDelay(RequestDelay.FromSeconds(2, 2)) //отсрочка запросов
                        .SetSessionHandler(new FileSessionHandler()
     {
         FilePath = (Environment.CurrentDirectory + PathContract.pathAccount + userSession.UserName + PathContract.stateFile)
     })
                        .Build();
 }
コード例 #24
0
        public async void Task()
        {
            IInstaApi api = InstaApiBuilder.CreateBuilder().SetUser(new UserSessionData()
            {
                UserName = "******",
                Password = "******"
            }).UseLogger(new DebugLogger(LogLevel.Exceptions)).Build();

            api.LoadStateDataFromString("{\"DeviceInfo\":{\"PhoneGuid\":\"5a61abd5-439d-46d9-87d8-12eb34f83f83\",\"DeviceGuid\":\"522df03a-f190-411a-8002-6387ce68b1d9\",\"GoogleAdId\":\"f3515bbd-bdab-4011-87d1-b5cc24339395\",\"RankToken\":\"49cd61ee-7238-462f-ba64-e20bc81aad32\",\"AdId\":\"c18d8ee6-6810-4cfa-ba3f-8036b94dd68f\",\"PigeonSessionId\":\"f2194902-5065-4b5d-bc8e-e21bce8dbee6\",\"PushDeviceGuid\":\"51ed147a-8064-4c7e-9cd7-8f5ef5ea1ec6\",\"FamilyDeviceGuid\":\"e03f6991-61ee-4d27-ba6e-fcec639ede00\",\"AndroidVer\":{\"Codename\":\"Jelly Bean\",\"VersionNumber\":\"4.3\",\"APILevel\":\"18\"},\"AndroidBoardName\":\"f6t\",\"AndroidBootloader\":\"1.0.0.0000\",\"DeviceBrand\":\"lge\",\"DeviceId\":\"android-368ed3e31e42adbd\",\"DeviceModel\":\"LG-D500\",\"DeviceModelBoot\":\"qcom\",\"DeviceModelIdentifier\":\"f6_tmo_us\",\"FirmwareBrand\":\"f6_tmo_us\",\"FirmwareFingerprint\":\"lge/f6_tmo_us/f6:4.1.2/JZO54K/D50010h.1384764249:user/release-keys\",\"FirmwareTags\":\"release-keys\",\"FirmwareType\":\"user\",\"HardwareManufacturer\":\"LGE\",\"HardwareModel\":\"LG-D500\",\"Resolution\":\"1440x2560\",\"Dpi\":\"640dpi\",\"IGBandwidthSpeedKbps\":\"1427.424\",\"IGBandwidthTotalBytesB\":\"1255092\",\"IGBandwidthTotalTimeMS\":\"879\"},\"UserSession\":{\"UserName\":\"the_shichko.exe\",\"Password\":\"puzahainsta\",\"PublicKey\":\"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF4SVovcFhtWkt2NWwyaXRaV1VSTgovdThCUS90V1NvanRDYmVSdm1sNmV4NHJPVFB4WHc4cDZEV0FjbHQvZktqWng4ek9VczlDRkRmVlp1d1oybm9jCjd6MUtxWlE4UXpDVHFsd0kyNWZEMTVTOFdxSEV3YS9IYjBZNEpvbmtlVlFVQkZiU1FPZmp4UnZkcksyODR1N0oKM1FyWEoySVYzck9XTTU2WkJmZ29ZVTJnV3drNHVQYTNoTWVJelV3c1RBY1dtRU1qOW05WFdhZ2J2bEpJM3NoUAp1ci9vbCs4SEpOdFhROWJYOEU0KzBrOFBCZU5rTk5OSUZIM3k3ajRGZ0JqbXJWWS9ZU1VQMHMzS1ZqSlZSN3o3CjFDNzZCaXVYK0RTakRMbGx3UTQySmlMNVdSbDVjTktNalA0dHZZWE9Qa2QxTG81UzJqVURJYmo0N1Rud0pTejYKclFJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==\",\"PublicKeyId\":\"223\",\"WwwClaim\":null,\"FbTripId\":null,\"Authorization\":null,\"LoggedInUser\":{\"IsVerified\":false,\"IsPrivate\":true,\"Pk\":1762195401,\"ProfilePicture\":\"https://instagram.fmsq1-1.fna.fbcdn.net/v/t51.2885-19/s150x150/87433407_523396181891831_2478325150609571840_n.jpg?_nc_ht=instagram.fmsq1-1.fna.fbcdn.net&_nc_ohc=b-K9Py8i9kEAX8Lt3M-&oh=947abf4f0998372d44d9858897b36acc&oe=5EAFB3AA\",\"ProfilePicUrl\":\"https://instagram.fmsq1-1.fna.fbcdn.net/v/t51.2885-19/s150x150/87433407_523396181891831_2478325150609571840_n.jpg?_nc_ht=instagram.fmsq1-1.fna.fbcdn.net&_nc_ohc=b-K9Py8i9kEAX8Lt3M-&oh=947abf4f0998372d44d9858897b36acc&oe=5EAFB3AA\",\"ProfilePictureId\":\"2249670442686493167_1762195401\",\"UserName\":\"the_shichko.exe\",\"FullName\":\"s h i c h o k\"},\"RankToken\":\"1762195401_5a61abd5-439d-46d9-87d8-12eb34f83f83\",\"CsrfToken\":\"xWXnIWDDfzcOsgvlxEO8zN0k1BlhEClU\",\"FacebookUserId\":\"\",\"FacebookAccessToken\":\"\"},\"IsAuthenticated\":true,\"Cookies\":{\"Capacity\":300,\"Count\":9,\"MaxCookieSize\":4096,\"PerDomainCapacity\":20},\"RawCookies\":[{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":false,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2021-04-02T10:27:09+03:00\",\"Name\":\"csrftoken\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.341723+03:00\",\"Value\":\"H3CKefqIhIg8alGxaXOq6eBOqYqkzH1i\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"0001-01-01T00:00:00\",\"Name\":\"rur\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417668+03:00\",\"Value\":\"FRC\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":false,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2030-04-01T10:26:29+03:00\",\"Name\":\"mid\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:26:30.9639816+03:00\",\"Value\":\"XoblJQABAAGHRR41FGJkczpCLNZk\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2020-07-02T10:27:09+03:00\",\"Name\":\"ds_user\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3416717+03:00\",\"Value\":\"the_shichko.exe\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2020-04-10T10:27:09+03:00\",\"Name\":\"shbid\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417409+03:00\",\"Value\":\"7957\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2020-04-10T10:27:09+03:00\",\"Name\":\"shbts\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417544+03:00\",\"Value\":\"1585898829.3089757\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":false,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2020-07-02T10:27:09+03:00\",\"Name\":\"ds_user_id\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417759+03:00\",\"Value\":\"1762195401\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"0001-01-01T00:00:00\",\"Name\":\"urlgen\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417896+03:00\",\"Value\":\"\\\"{\\\\\\\"46.216.66.54\\\\\\\": 25106}:1jKGjN:02IQ0iIkQsfUdc4mukgarllFVDc\\\"\",\"Variant\":1,\"Version\":0},{\"IsQuotedDomain\":false,\"IsQuotedVersion\":false,\"Comment\":\"\",\"CommentUri\":null,\"HttpOnly\":true,\"Discard\":false,\"Domain\":\".instagram.com\",\"Expired\":false,\"Expires\":\"2021-04-03T10:27:09+03:00\",\"Name\":\"sessionid\",\"Path\":\"/\",\"Port\":\"\",\"Secure\":true,\"TimeStamp\":\"2020-04-03T10:27:09.3417978+03:00\",\"Value\":\"1762195401%3Aop7jnRQaOx88F1%3A6\",\"Variant\":1,\"Version\":0}],\"InstaApiVersion\":22}");

            IResult <InstaCommentList> comments = await api.CommentProcessor.GetMediaCommentsAsync("2303279398725811943",
                                                                                                   PaginationParameters.MaxPagesToLoad(5));
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: xuan2261/InstagramApiSharp
 IInstaApi BuildApi()
 {
     return(InstaApiBuilder.CreateBuilder()
            .SetUser(UserSessionData.ForUsername("FAKEUSERNAME").WithPassword("FAKEPASS"))
            .UseLogger(new DebugLogger(LogLevel.All))
            .SetRequestDelay(RequestDelay.FromSeconds(0, 1))
            // Session handler, set a file path to save/load your state/session data
            .SetSessionHandler(new FileSessionHandler()
     {
         FilePath = StateFile
     })
            .Build());
 }
コード例 #26
0
        public InstaClass(String username, String pwd)
        {
            UserData = new UserSessionData
            {
                UserName = username,
                Password = pwd
            };

            api = InstaApiBuilder.CreateBuilder()
                  .SetUser(UserData)
                  .UseLogger(new DebugLogger(LogLevel.All))
                  .Build();
        }
コード例 #27
0
ファイル: Form1.cs プロジェクト: pictos/InstagramApiSharp
 IInstaApi BuildApi()
 {
     return(InstaApiBuilder.CreateBuilder()
            .SetUser(UserSessionData.Empty)
            .UseLogger(new DebugLogger(LogLevel.All))
            .SetRequestDelay(RequestDelay.FromSeconds(0, 1))
            // Session handler, set a file path to save/load your state/session data
            .SetSessionHandler(new FileSessionHandler()
     {
         FilePath = StateFile
     })
            .Build());
 }
コード例 #28
0
        public async Task AuthAsync(string login, string password)
        {
            InstaApi = InstaApiBuilder.CreateBuilder()
                       .SetUser(new UserSessionData
            {
                UserName = login,
                Password = password
            })
                       .SetRequestDelay(RequestDelay.FromSeconds(0, 2))
                       .Build();

            RiseAuthStateChanged(await TryAuthAsync());
        }
コード例 #29
0
        public static void buildApi()
        {
            var data = new UserSessionData
            {
                UserName = Constants.username,
                Password = Constants.password
            };

            api = InstaApiBuilder.CreateBuilder()
                  .SetUser(data)
                  .UseLogger(new DebugLogger(LogLevel.Exceptions))
                  .Build();
            Logging.log("API built");
        }
コード例 #30
0
ファイル: Person.cs プロジェクト: esbazhin/InstaChatBot
        public async Task Run()
        {
            if (!CheckOK(false))
            {
                return;
            }

            var user = new UserSessionData
            {
                UserName = Login,
                Password = this.Password
            };

            if (api == null)
            {
                api = InstaApiBuilder.CreateBuilder()
                      .SetUser(user)
                      .UseLogger(new DebugLogger(LogLevel.Exceptions))
                      .SetRequestDelay(RequestDelay.FromSeconds(1, 3))
                      .Build();
            }
            var succ = await api.LoginAsync();

            if (!succ.Succeeded)
            {
                Task.Factory.StartNew(() => MessageBox.Show("Ошибка: " + succ.Info.Message, "Персонаж: " + name));
                return;
            }

            var curUser = await api.GetCurrentUserAsync();

            if (!curUser.Succeeded)
            {
                Task.Factory.StartNew(() => MessageBox.Show("Ошибка: " + curUser.Info.Message, "Персонаж: " + name));
                return;
            }


            working = true;


            Task[] tasks = { FirstMessages(), Answer(curUser.Value) };
            await Task.WhenAll(tasks);


            //await FirstMessages();
            //await Answer(curUser.Value.Pk);
            await api.LogoutAsync();
        }