Reputation: 1740
I'm extracting some data using imacros, and trying to append that data into a csv. This is my code for extraction
'Gives me a numeric value(e.g 14)
TAG POS=1 TYPE=span ATTR=CLASS:proPriceField&&TXT:* EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.match(/[0-9,]+/);")
'Gives me a numeric value(e.g 2456)
TAG POS=1 TYPE=span ATTR=CLASS:sqrPriceField&&TXT:* EXTRACT=TXT
SET abc EVAL("'{{!EXTRACT}}'.match(/[0-9,]+/);")
'Gives me a text value(e.g "Kalyan")
TAG POS=1 TYPE=span ATTR=CLASS:localityFirst&&TXT:* EXTRACT=TXT
'Gives me lattiude from a link
TAG POS=2 TYPE=a ATTR=class:stop-propagation&&TXT:* EXTRACT=HTM
SET lat EVAL("'{{!EXTRACT}}'.match(/\?(lat=.+?)&/)[1];")
'Gives me longitude from a link
SET longt EVAL("var regex = /longt=(\\d+(?:\\.\\d+)?)/g; var str = '{{!EXTRACT}}';str.match(regex)[1];")
SAVEAS TYPE=!EXTRACT FOLDER=* FILE=temp.csv
This is the link from where I'm extracting data.
I'm expecting data should be appended in the following format
ProPrice SqrPrice Locality Lat Longt
14 2456 Kalyan 19.456 17.897
But the above code gives error "reject is not defined, line: 20 (Error code: -1001)"
while writing data in csv, Any suggestion on why is it happening. Any help would be much appreciated.Thanks
Upvotes: 0
Views: 230
Reputation: 5299
I corrected your code a little:
'Gives me a numeric value(e.g 14)
TAG POS=1 TYPE=span ATTR=CLASS:proPriceField&&TXT:* EXTRACT=TXT
SET ProPrice EVAL("'{{!EXTRACT}}'.match(/[0-9,]+/);")
SET !EXTRACT NULL
'Gives me a numeric value(e.g 2456)
TAG POS=1 TYPE=span ATTR=CLASS:sqrPriceField&&TXT:* EXTRACT=TXT
SET SqrPrice EVAL("'{{!EXTRACT}}'.match(/[0-9,]+/);")
SET !EXTRACT NULL
'Gives me a text value(e.g "Kalyan")
TAG POS=1 TYPE=span ATTR=CLASS:localityFirst&&TXT:* EXTRACT=TXT
SET Locality {{!EXTRACT}}
SET !EXTRACT NULL
'Gives me lattiude from a link
TAG POS=2 TYPE=a ATTR=class:stop-propagation&&TXT:* EXTRACT=HTM
SET lat EVAL("'{{!EXTRACT}}'.match(/\?(lat=.+?)&/)[1];")
'Gives me longitude from a link
SET longt EVAL("var regex = /longt=(\\d+(?:\\.\\d+)?)/g; var str = '{{!EXTRACT}}';str.match(regex)[1];")
SET !EXTRACT {{ProPrice}}[EXTRACT]{{SqrPrice}}[EXTRACT]{{Locality}}[EXTRACT]{{lat}}[EXTRACT]{{longt}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=temp.csv
Upvotes: 1