Borrar filtros
Borrar filtros

Reading urls only from a text file

2 visualizaciones (últimos 30 días)
ab
ab el 1 de Jul. de 2013
I have a text file having multiple urls with other information of the url.I want to download images from all the urls. How can I read the txt file and save the URLS only in an array to download it? I want to use C=textscan(fileId,formatspec) What should I mention in formatspec for URL as format? My text file has the content shown as below:
ID: 262
Name: VD0289 CUT OUT BACK DRESS
Image: http://dwimages.com/images/product/1/VD0289_VD0289_(4).jpg
Detailed Image: http://dwimages.com/images/detailed/0/VD0289_VD0289_(4).jpg
Image: http://dwimages.com/images/product/1/
Detailed Image: http://dwimages.com/images/detailed/1/VD0289_VD0289_(4).jpg
Detailed Image: http://dwimages.com/images/detailed/0/VD0289_VD0289.jpg
  2 comentarios
Matt Kindig
Matt Kindig el 1 de Jul. de 2013
I would use regular expressions instead of textscan(). Something like this should do it:
str= fileread('/path/to/your/file.txt'); %read in text file to memory
urls = regexp(str, 'http(\S+)(\s*)$', 'match', 'lineAnchors'); %find urls
ab
ab el 1 de Jul. de 2013
Editada: ab el 1 de Jul. de 2013
Thanks it worked :).How can I assign the Name:VD0289 CUT OUT BACK DRESS to all the images under it in a lookup table.I have a lot of datas in this same format in the same txt file.Eg
I have this datas how can I make a lookup table to assign each url with its name and tags.that is the first 5 image should have the same name and tags assigned.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by