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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,433
Messages
6,124,863
Members
449,195
Latest member
MoonDancer

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