I am trying to create a c# program that will be able to automatically download lectures from Macquarie University’s Echo Centre.
Example link: http://echo.mq.edu.au:8080/ess/portal/section/ANTH106_FHFYR_2012
The problem is I have no idea how to select the download link for the mp3 or m4v (if at all possible). The only solution I have come up with is downloading the source and attempting to parse it for links.
If someone could please advise me on how to select download links from within a browser object that would be excellent 🙂 Otherwise I will just try working with the source.
Broswer browser = new Broswer(address);
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
MessageBox.Show("This machine needs to be connected to the internet to download your lectures.\n\nPlease connect to the internet and try again.", "Network Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
//
}
You will need to scrape the page’s HTML and look for links. You can either try an available API for reading HTML documents programmatically, such as the HtmlAgilityPack, or parsing it manually, using regex or whatever you’d like.
Once you have the URL to a file, you can use
HttpWebRequestto programmatically download a file.