I am trying to extract data from an HTML page using C# code. I am currently loading the page as a string with System.Net.WebClient and utilizing HTML Agility Pack to retrieve information within HTML tags such as forms, labels, and inputs.
The issue arises when some of the content is embedded within a JavaScript script tag like this:
<script type="text/javascript">
//<![CDATA[
var itemCol = new Array();
itemCol[0] = {
pid: "01010101",
Desc: "Some desc",
avail: "Available",
price: "$10.00"
};
itemCol[1] = {
pid: "01010101",
Desc: "Some desc",
avail: "Available",
price: "$10.00"
};
//]]>
</script>
Could someone please advise on how I can convert this JavaScript object into a collection in .NET? Is there any way to achieve this using HTML Agility Pack? Any assistance would be greatly appreciated.
Thank you in advance.