get data from website by vb

arash007

New Member
Joined
Jun 12, 2017
Messages
1
Hi i have problem to get data with this site
http://cdn.tsetmc.com/Loader.aspx?ParTree=15131P&i=57875847776839336&d=20170606

In this website we have a lot of data what i need to get is tagged by "//script[contains(text(), 'BestLimitData')]"
and "var IntraTradeData"
what is the vb code to get these data ?

the code in C# is :


string tsetmcUrl = "http://cdn.tsetmc.com/Loader.aspx? ParTree=15131P&i=57875847776839336&d=20170606"
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(tsetmcUrl);
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
request.AutomaticDecompression = DecompressionMethods.GZip;
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
//parse the values out of HTML
var htmlPack = new HtmlAgilityPack.HtmlDocument();
htmlPack.LoadHtml(responseString);
var results = htmlPack.DocumentNode.SelectSingleNode("//script[contains(text(), 'BestLimitData')]").InnerHtml;
var allResults = htmlPack.DocumentNode.SelectSingleNode("//script[contains(text(), 'ClosingPriceData')]").InnerHtml.Split(';');
var results = allResults.FirstOrDefault(x=>x.Contains("IntraTradeData"));
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,225,739
Messages
6,186,741
Members
453,370
Latest member
juliewar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top