Filter löschen
Filter löschen

Reading urls only from a text file

2 Ansichten (letzte 30 Tage)
ab
ab am 1 Jul. 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 Kommentare
Matt Kindig
Matt Kindig am 1 Jul. 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 am 1 Jul. 2013
Bearbeitet: ab am 1 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by