The webpage use javascript to build its html so I need html parser with js support.
I found anglesharp but I can't make it working.
using AngleSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace AngleSharpScraping
{
class Program
{
static void Main(string[] args)
{
GetMkvToolNix();
Console.ReadKey();
}
static async void GetMkvToolNix()
{
// Create a new configuration with javascript interpreter.
var config = new Configuration().WithJavaScript();
// Parsing process.
var document = await BrowsingContext.New(config).OpenAsync(Url.Create("http://www.fosshub.com/MKVToolNix.html"));
var link = document.QuerySelector("body > div.container.page-content > div > div.col-sm-9 > article > div.main-dl-box > p:nth-child(2) > a.dwl-link.xlink").GetAttribute("data");
Console.WriteLine(link);
}
}
}
AngleSharp is a text parser. If you want to scrape dynamic web pages with JS, you'll need a headless browser.
This answer provides a couple of options (at least one free and open source: WebKit.NET).