string keywordString = Title; string uriString = " https://www.google.com/search?q=" + keywordString; WebClient webClient = new WebClient(); NameValueCollection nameValueCollection = new NameValueCollection(); nameValueCollection.Add("q", keywordString); webClient.QueryString.Add(nameValueCollection); Console.WriteLine(webClient.DownloadString(uriString.ToString())); string LinksHTML = webClient.DownloadString(uriString.ToString()); // ExtractingLinks //string text = System.IO.File.ReadAllText(@"F:\fixable q mark\fixable q mark\die.txt"); if (LinksHTML.Contains("<a href=")&& LinksHTML.Contains("ping=")) { Console.WriteLine("lol"); var matches = Regex.Matches(LinksHTML, "<a href=(.*?) ping="); //var doc = new HtmlDocument(); //doc.LoadHtml(LinksHTML); //HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//a[@href]"); foreach (Match item in matches) { string node = item.ToString(); // Console.WriteLine(text); // outputs HtmlAgilityPack.HtmlNode instead o th actual link!! string link = node.ToString(); if (!link.Contains("#") || !link.Contains("support.google")) { string w = item.ToString(); w.Remove(8); w.Remove(w.Length - 5); Console.WriteLine("Bonjour"); Console.WriteLine(w); // URLSofCs.Add(w); } } } else { Console.WriteLine("No links could be found "); Console.WriteLine("An error Occured"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)