Get URL from WebBrowser

mynoicity

New member
Joined
Jul 6, 2021
Messages
1
Programming Experience
Beginner
Dear all,

My ideal:
1- Use webbrowser with "url a" is ID of fb ID
2- Webpage will be response to "url b"
3 - I get value of "url b" is fb name alias

Simple like that. With a url. It OK
If have a list of url. I dont know how to do.

Please help me for idea

Here is my code:


Winforms behind code:
  public partial class Form1 : Form

        {

            public DataTable dt = new DataTable();

            public Form1()

            {

                InitializeComponent();

            }

    

            private void Form1_Load(object sender, EventArgs e)

            {

                dt.Columns.Add("ID");

                var d1 = new DataTable();

                d1.Columns.Add("ID");

                d1.Rows.Add("https://facebook.com/100035980120039");

                d1.Rows.Add("https://facebook.com/100007248495763");

                for (int i = 0; i < d1.Rows.Count; i++)

                {

                    webBrowser1.Navigate(d1.Rows[i][0].ToString().ToString());

                    textBox1.Text = d1.Rows[i][0].ToString().ToString();

                }

                dataGridView1.DataSource = dt;

            }

    

            private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)

            {

                textBox2.Text = e.Url.ToString();

                string s1 = textBox2.Text;

                string s2 = s1.Replace("https://facebook.com/", "");

                string[] arr = s2.Split('?');

                textBox3.Text = arr[0] + "Facebook@facebook.com";

                dt.Rows.Add(arr[0] + "Facebook@facebook.com");

            }

        }
 
That sounds like a terrible idea for harvesting people's friendly FaceBook IDs from a set of FaceBook account IDs. You should be using the FaceBook APIs directly instead of trying to this kind of hackery.
 
My hunch is they are scraping for user Id's because facebook would likely terminate any application who tries to obtain a users id.
There are old posts online that allow you to call this api : https://graph.facebook.com/me?fields=id&access_token="your token" but I believe you can not use this api any more. If memory served me correctly, it stopped working for people.
 
Back
Top Bottom