I am trying to scrape a webpage for links of articles.
This is my code:
static void Main(string[] args)
{
WebClient web = new WebClient();
string html = web.DownloadString("http://www.dailymirror.lk");
MatchCollection m1 = Regex.Matches(html, @"<a href=""(.+?)""/s*class=""panel-heading"">",RegexOptions.Singleline);
foreach(Match m in m1)
{
Console.WriteLine(m.Groups[1].Value);
}
}
The html markup that I am focused on in the page is this:
<a href="http://www.dailymirror.lk/99833/ravi-s-budget-blues" class="panel-heading">
However, my code is unable to retrieve the link, is there anyway I could revamp my code?