Here are some problems and workarounds for frequently asked questions:
Q: EXTRACT works while I am testing in the Extraction Wizard, but when I run the macro, Extract only returns #EANF# (Extraction Anchor not found).
A: Some websites are created dynamically from databases and the exact content of the website changes every time you visit a page. The solution is to replace the changing part of a link or extraction with the wildcard symbol.
Example:
Assume you searched for a product on a retailers site and the resulting page is a table of products, each with its own description and price tag, which are enclosed by the A HTML tag, like so:
<TR>
<TD>
<A class=price href="/homes/homesforsale/view_details.jsp?advertID=14470882&listID=2492&index=1&">
Product 1, Price 1
</A>
</TD>
</TR>
<TR>
<TD>
<A class=price href="/homes/homesforsale/view_details.jsp?advertID=14470882&listID=2492&index=1&">
Product 2, Price 2
</A>
</TD>
</TR>
<TR>
<TD>
<A class=price href="/homes/homesforsale/view_details.jsp?advertID=14470882&listID=2492&index=1&">
Product 3, Price 3
</A>
</TD>
</TR>
[...]
Here is an extraction anchor as suggested by the Wizard for the first product:
EXTRACT POS=1 TYPE=TXT ATTR=<A<SP>class=price<SP>href="/homes/homesforsale/view_details.jsp?advertID=14470882&listID=2492&index=1&">*
This command worked fine in the Wizard, but failed during the macro execution. Why? Because the listID part of the URL changes every time you visit the page. You can find this out, by running the Wizard twice (after refreshing the page in between) and comparing the extraction anchors. We also note that the variable advertID is probably the most important part of the link, since it defines the ad.
Solution:
Replace the changing listID number with *:
EXTRACT POS=1 TYPE=TXT ATTR=<A<SP>class=price<SP>href="/homes/homesforsale/view_details.jsp?advertID=14470882&listID=*&index=1&>*
Actually, while you are at it, you can remove most static parts of the anchor as well. The result looks like:
EXTRACT POS=1 TYPE=HREF ATTR=<A<SP>class=price<SP>href="*advertID=14470882*">*
If you want to cycle through all the ads on the page, you can do this as follows:
1. Replace the advertID number by an asterisk. Now, it will always find the matching extraction anchor.
2. To tell iMacros go for the second (third,....) product, change the POS parameter with a variable:
EXTRACT POS={{!LOOP}} TYPE=HREF ATTR=<A<SP>class=price<SP>href="*advertID=*">*
During runtime, {{!LOOP}} takes on the values 1, 2, 3,... iMacros extracts the price on this page consecutively.
Page URL http://www.iopus.com/imacros/help/extract_techtips.htm