Get a specific number in a web page for a variable

Hello.

I would like to create a unity web player content that show in a diagram the daily biggest earthquakes magnitudes that are stored in a web page. Here is a snapshot of the information that interrest me in the web page :

So i would like to put a function in my script that permit me to store the magnitude informations find in the web page and convert it in variables that will be the Y size of the boxes that represent the diagram. For example, a magnitude of 4.6 will put the Y size of the box : 4.6. Here is a simplified representation of the result that i would like to have after my script analise the web page and transcribe it in a scene:

I was looking here where we can send the script to find an image in a web site and put it as a texture. But in my case, it’s text and not image that i would like to take, and of course, not a casual text… but an information that is in a specified place from the page…

Can someone give me an example of script that can work in my case? (Javascript por favor :smile:)

This is not as simple as it sounds, you have to load and parse the whole HTML page either as an XML document or by some other means then find the info you’re after.

Also, unless you own the content of the web page “scraping” data as this practice is called is generally frowned upon and may even violate copyright laws.

If you own the content you’re much better off creating a server side script that can provide just the data you want as XML which is rather trivial to load into unity. Lots of XML loading resources around on the forums and the wiki.

C# class that parses web pages by node. Would have an array of your table data in 2-3 lines of code.

http://htmlagilitypack.codeplex.com/

Other than that it’s brute force parsing with Regex and/or String Class classics such as Split().

Thank you a lot for your answers. Cameron, it’s not my website that contain the informations, but of course i will never put my final result in internet before asking to the webmaster of the website if he agree that. I work in a litle society and everything is doing in the rules :smile:

Quietus, your program seems to be very interresting and i will take a look on it. In another way, i was asking in the forum of “Auto-it” if the program can search the information that interrest me and put each magnitude in a single file text that unity will be able to read and translate in variable. (the project look for a web player content, but a machine will be the servor and this machine will run a stand alone that will be able to read the text files and send it to the dedicated servor that concern the web player (so the servor will contain the number that will be translate in variable).

Quietus2 how did you import the aglity pack into unity?