Fetching "Inspect Elements" from HTML

18 views (last 30 days)
Anton
Anton on 7 Sep 2015
Commented: Anton on 8 Sep 2015
Hello
So i dont know if this can be done or not, but i have not been able to find any posts about it. What i want to do is fetch information that changes in diffrent elements on a HTML page. To simply download the page source using URLread gives me nothing since the values are not stored there. It might just be my lack of knowledge about HTML that makes me ask this question, but so be it.
Thanks in advance
  2 Comments
Cedric
Cedric on 7 Sep 2015
Edited: Cedric on 7 Sep 2015
Could you provide the URL of a few of these pages, and explain what you are trying to extract?
Anton
Anton on 7 Sep 2015
What i am trying to extract is odds from a betting site. I was asked by a friend to plot over time how the odds changes before the game starts to find a "sweet-spot" to place the bet.
Here is the URL i've been using: https://svenskaspel.se/?pageid=/sport/oddsetlangen
Its a Swedish betting site, if you wonder why its filled with jibberish.

Sign in to comment.

Answers (1)

Guillaume
Guillaume on 7 Sep 2015
Edited: Guillaume on 7 Sep 2015
If the data you're interested in gets displayed through javascript then there's not much you can do short of implementing your own web browser (at least the javascript interpreting bit) in matlab or interacting with an existing browser. See this related discussion.
Possibly, the website you're accessing may have an API to fetch the data you want, most likely using xml. In that case, you could use webread.
  4 Comments
Cedric
Cedric on 8 Sep 2015
Edited: Cedric on 8 Sep 2015
Image recognition will not work too well either, because you have to open pages manually, take a screen shot, etc, so this cannot be done on a regular and fast basis.
If I were you, I would try to see if I could access the content after the JS (or whatever else) is execute, from e.g.
web( 'https://svenskaspel.se/?pageid=/sport/oddsetlangen' )
or from Firefox. If you open the page in Firefox, right click on one of the numbers and select "Inspect element (Q)", you will see that the inspector tool displays the value. There may be a way to get this information from some plugin rather than the raw HTML source which contains the call.
Anton
Anton on 8 Sep 2015
I've sorted out to open the page, screen shot it and crop out the diffrent odds, so i guess is should be doable with image recognition.
Apparently the built-in browser in matlab cant inspect specific elements which is a shame really - or at least i cant figure out how to do it.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!