Extract hyperlink from data retrieved through urlread()
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Graeme MacKenzie
el 14 de Jun. de 2016
Comentada: Graeme MacKenzie
el 20 de Jun. de 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 comentarios
Respuesta aceptada
Julian
el 17 de Jun. de 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?
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!