Dino
Dino

Reputation: 1457

How to loop and extract data from various url's using the iMacros Addon for Firefox

I would like to extract data form a spacific url such as www.example.com/data.php?id=xx

Where xx is a number between 1 and 1000 (ie. the script should loop through) and extract the data so far I have the following script:

VERSION BUILD=7401110 RECORDER=FX TAB 
T=1 
SET !LOOP 1 
URL GOTO=http://www.example/data.php?id={{!LOOP}} 
TAG POS=2 TYPE=TD ATTR=TXT:* EXTRACT=TXT

Now how can I achieve this to loop properly also if a url eg www.example.com/data.php?id=4 does not exist no data is extracted but the script continues and finally how can I get the data to be outputted to a file?

Thanks

Upvotes: 1

Views: 4326

Answers (2)

Bestmacros
Bestmacros

Reputation: 1867

you need to set error ignore to make the script continue if data not found, use this:

SET !ERRORIGNORE YES

Upvotes: 1

mflips
mflips

Reputation: 321

With the macro you wrote, if you use the Loop function (that is, hit the play loop button) the macro is going to load one url after the other and extract the desired data.

However, the data is not going to be saved, but presented to you in a popup at each step. To avoid that, include the command

SET !EXTRACT_TEST_POPUP NO

at the beginning. For the saving, use SAVEAS TYPE=EXTRACT

Upvotes: 2

Related Questions