Untitled
unknown
plain_text
4 years ago
1.2 kB
6
Indexable
using HtmlAgilityPack; using System.Net; public String html; public Uri url; private void buttonVeriAl_Click(object sender, EventArgs e) { VeriAl(textBoxLink.Text, "/html/body/div[7]/div[2]/div[1]/div[1]/div[1]/h1","name", listBox1); } public void VeriAl(String Url, String XPath,String dip, ListBox CikanSonuc) { try { url = new Uri(Url); } catch { MessageBox.Show("Hata"); } WebClient client = new WebClient(); client.Encoding = Encoding.UTF8; try { html = client.DownloadString(url); } catch (WebException) { MessageBox.Show("Hata URL"); } HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); try { CikanSonuc.Items.Add(doc.DocumentNode.SelectSingleNode(XPath).Attributes[dip].Value); } catch (NullReferenceException) { MessageBox.Show("Hata xpath"); } }
Editor is loading...