Created
August 20, 2018 16:56
-
-
Save fluupo/10fd42379a89a5cde04dd6c3282795c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void BtnAramaYap_Click(object sender, EventArgs e) | |
{ | |
HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb(); | |
HtmlAgilityPack.HtmlDocument doc = web.Load("https://www.google.com.tr/search?q=" + tbKelime.Text); | |
var links = doc.DocumentNode.SelectNodes("//h3[@class='r']/a").ToList(); | |
foreach (var link in links) | |
{ | |
if (link.OuterHtml.Contains("/url?q=")) | |
{ | |
tbBasliklar.Text += System.Web.HttpUtility.HtmlDecode(link.InnerText) + "\r\n"; | |
string hrefValue = link.GetAttributeValue("href", string.Empty); | |
int index = hrefValue.IndexOf("&"); | |
if (index > 0) | |
{ | |
var l = hrefValue.Substring(0, index); | |
tbSiteler.Text += System.Web.HttpUtility.UrlDecode(l.Replace("/url?q=", "")) + "\r\n"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment