private void button4_Click(object sender, EventArgs e) { if (textBox1.Text == " " || textBox1.Text == "") { BeginInvoke(new Action(() => { new ErrorMessageBox("Lütfen bir kullanıcı adı giriniz!", FormStartPosition.CenterParent).ShowDialog(); })); return; } button4.Enabled = false; try { InstagramClient ig_client = new InstagramClient("hichigo", "hichigo", 60); var res = ig_client.GetUserInfo(textBox1.Text); var text = ig_client.GetTextFromResponse(res); listBox1.Items.Clear(); listBox2.Items.Clear(); JObject json = JObject.Parse(text); target_info = json; target_id = json["graphql"]["user"]["id"].Value <string>(); textBox2.Text = json["graphql"]["user"]["id"].Value <string>(); textBox3.Text = json["graphql"]["user"]["biography"].Value <string>(); textBox3.Text = json["graphql"]["user"]["biography"].Value <string>(); textBox7.Text = json["graphql"]["user"]["full_name"].Value <string>(); textBox5.Text = json["graphql"]["user"]["edge_followed_by"]["count"].Value <string>(); textBox6.Text = json["graphql"]["user"]["edge_follow"]["count"].Value <string>(); textBox4.Text = json["graphql"]["user"]["edge_owner_to_timeline_media"]["count"].Value <string>(); pictureBox9.ImageLocation = json["graphql"]["user"]["profile_pic_url_hd"].Value <string>(); if (textBox4.Text != "0") { int i = 1; foreach (var post in json["graphql"]["user"]["edge_owner_to_timeline_media"]["edges"]) { listBox1.Items.Add("Gönderi #" + i.ToString()); listBox2.Items.Add("Gönderi #" + i.ToString()); i++; } } } catch (ResponseIsNotOK) { BeginInvoke(new Action(() => { new ErrorMessageBox("Bağlantı hatası gerçekleşti! Kullanıcı adını kontrol edin!", FormStartPosition.CenterParent).ShowDialog(); })); return; } catch (WebException) { BeginInvoke(new Action(() => { new ErrorMessageBox("Bağlantı hatası gerçekleşti!", FormStartPosition.CenterParent).ShowDialog(); })); return; } catch (CookieNotFound) { BeginInvoke(new Action(() => { new ErrorMessageBox("Bağlantı hatası gerçekleşti! Lütfen tekrar deneyin!", FormStartPosition.CenterParent).ShowDialog(); })); return; } catch (TaskCanceledException) { } catch (Exception ex) { PrintErrorToLog(richTextBox1, "\n\n[" + username + "] " + "Bu hatayı yapımcıya iletin!\n" + ex.Message + " " + ex.Source + " " + ex.StackTrace + "\n\n"); } button4.Enabled = true; }
public async Task User_User() { var client = new InstagramClient(); var response = await client.GetUserInfo("2175453"); Assert.AreEqual(200, response.meta.code); }