Advertisement
AhmedSokr

Untitled

Jan 29th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace FBComments
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. string link = "https://www.facebook.com/groups/";
  23. webBrowser1.Navigate(link + textBox1.Text + "/members/");
  24. timer1.Start();
  25. }
  26. public bool HHH = true;
  27. public List<string> IDs = new List<string>();
  28. private void timer1_Tick(object sender, EventArgs e)
  29. {
  30. try
  31. {
  32. if (HHH)
  33. {
  34. var links = webBrowser1.Document.GetElementsByTagName("div");
  35. foreach (HtmlElement link in links)
  36. {
  37. if (link.GetAttribute("className") == "clearfix _60rh _gse")
  38. {
  39. var Name = link.OuterHtml.Split(new[] { "aria-label" }, StringSplitOptions.None)[1];
  40. var href = link.OuterHtml.Split(new[] { "id" }, StringSplitOptions.None)[1];
  41. var GetIdPost = href.Split(new[] { "page_members_", "recently_joined_", "local_members_", "self_bio_", "admins_moderators_", "friends_", "things_in_common_" }, StringSplitOptions.None)[1];
  42.  
  43. string IDPost = GetIdPost.Substring(0, 16);
  44. var IDSp = IDPost.Split(new[] { "\"" }, StringSplitOptions.RemoveEmptyEntries);
  45. var Names = Name.Split(new[] { "\"" }, StringSplitOptions.RemoveEmptyEntries);
  46. if (!IDs.Contains(IDSp[0]))
  47. {
  48. IDs.Add(IDSp[0]);
  49. listBox2.Items.Add("" + IDSp[0] + " : " + Names[1]);
  50. listBox2.SelectedItem = listBox2.Items[listBox2.Items.Count - 1];
  51. label2.Text = "Member : " + IDs.Count;
  52. pictureBox1.Visible = true;
  53. }
  54. }
  55. }
  56. if (this.webBrowser1.Document != null)
  57. {
  58. webBrowser1.Document.Window.ScrollTo(0, webBrowser1.Document.Window.Size.Height);
  59. }
  60. }
  61. else timer1.Stop();
  62. }
  63. catch { timer1.Stop(); label2.Text = "Member : " + IDs.Count + " All Members"; }
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement