private string GrabTheUrl(string mainurl)
{
WebClient client = new WebClient();
string res = client.DownloadString(mainurl);
int where = res.IndexOf("https://www.gfxtra.com/engine/go");
int finish = res.IndexOf('"', where);
string first_url = res.Substring(where, finish - where);
client.Dispose();
client = new WebClient();
client.Headers.Set("referer", mainurl);
res = client.DownloadString(first_url);
where = res.IndexOf("color=");
where += 12;
finish = res.IndexOf('<', where);
first_url = res.Substring(where, finish - where);
return first_url;
}
( سایت کد رو به هم میریزه, از اینجا دان کن: https://paste.ubuntu.com/p/n6bJGjvfqg/ )
نمونه استفاده:
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(GrabTheUrl(textBox1.Text)); // open the url in the browser
}