Written by Anonymous
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Net; using System.IO; using HtmlAgilityPack; namespace InternerVeriCekme { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public string html; public Uri url; public void VeriAl(string Url,string XPath,TextBox cikansonuc) { try { url = new Uri(Url); } catch (UriFormatException) { if (MessageBox.Show("Hatalı URL", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { }; } catch(ArgumentNullException) { if (MessageBox.Show("Hatalı URL", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { }; } WebClient client = new WebClient(); client.Encoding = Encoding.UTF8; try { html = client.DownloadString(url); } catch (WebException) { if (MessageBox.Show("Hatalı URL", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { }; } HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); try { textBox1.Text = doc.DocumentNode.SelectSingleNode(XPath).InnerText; } catch (NullReferenceException) { if (MessageBox.Show("Hatalı xpath", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { }; } } private void button1_Click(object sender, EventArgs e) { if (bunifuMaterialTextbox1.Text != "") { VeriAl("https://www.instagram.com/lunaslol/", "/html[1]/body[1]/div[1]/section[1]/main[1]/div[1]/div[1]/h1[1]", textBox1); } } private void Form1_Load(object sender, EventArgs e) { } } }