Pergunta

There is a thread about it, but i could not make it happen. I should use eval but do not know how

tag pos=1 type=image attr=href:* extract=htm

set !extract eval("???")

After all the extract value should be an url.jpg

I will pick the answer with an example

Foi útil?

Solução

iMacros Doesn't support to extract src directly from HTML element. For this, you have to extract html element and after that using javascript eval with regex you can easily get src or any other part of html element

If your hrml element is something similar like the below

<img id="imgFull" src="http://mysite/images/51cBAfufUrL.jpg" class="image-stretch-vertical frontImage" style="max-width:230px; max-height:346px;">

Then, you can simply get SRC with the following code with iMacros

TAG XPATH="//img[@id="imgFull"]" EXTRACT=HTM
SET SRC EVAL("\"{{!EXTRACT}}\".match(/src.*class/)[0].replace(/src=\"/,\"\").replace(/\"\\sclass/,\"\");")
SET !EXTRACT NULL
ADD !EXTRACT {{SRC}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=SRC.csv
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top