Extract hyperlink from data retrieved through urlread()
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Graeme MacKenzie
am 14 Jun. 2016
Kommentiert: Graeme MacKenzie
am 20 Jun. 2016
I am trying to extract urls listed on a website using urlread. urlread gives me the page's content and regexprep allows me to isolate the content I'm interested in (shown in the command window) but I can't seem to extract the url contained in the hyperlink. urlread apparently doesn't return hyperlinks and yet when I hover over the hyperlink in the command window I can find the address I'm looking for (highlighted in yellow in the lower left corner of the image). Any way to extract the url in the hyperlink?
0 Kommentare
Akzeptierte Antwort
Julian
am 17 Jun. 2016
By default hyperlinks are rendered in the command window. You already have the underlying text that you want in your variable but you have to hover over the hyperlink to see it in the command window. The variable editor will show the underlying HTML. So you should easily be able to extract the URLs with something like
hyperlinks = regexp(html,'<a.*?/a>','match');
I have often though that it would be really useful to have something like "Copy Link Address" available on a right click in the command window (particularly to extract matlab: hyperlinks).. What do you think?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!