Extract dynamic content with iMacros - imacros

I'm entirely new to iMacros, and I'm trying to get iMacros to extract the email address that appears when you click "reply" on ads like these. (Link is "dead"...)
The only thing I have is:
VERSION BUILD=10021450
URL GOTO=https://losangeles.craigslist.org/sfv/res/d/need-extra-money/7027377618.html
TAG POS=1 TYPE=BUTTON ATTR=TXT:reply
I have tried simply using wildcards, which doesn't work.

I found the answer somehow:
TAG POS=1 TYPE=INPUT ATTR=CLASS:anonemail EXTRACT=TXT

Related

Clicking almost 2 identical urls with imacro

I am working on a imacro script and i am just stuck with it and can't figure out what i am doing wrong.
It is a macro thát visits a certain forum part and it needs to click 2 links.
They are almost identical except for 1 part.
It is used to download attachments.
Code i got at the moment:
TAG POS=1 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
TAB CLOSE
TAG POS=2 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
I also tried it like this:
TAG POS=1 TYPE=A ATTR=HREF:*linkhere*/forum.php?mod=attachment&aid=* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
SET !EXTRACT NULL
TAB CLOSE
TAG POS=2 TYPE=A ATTR=TXT:*.pdf EXTRACT=HREF
SET link EVAL("'{{!EXTRACT}}'.match(/(http.*)\./)[1];")
URL GOTO={{link}}
but still no luck.
As you see 1 file is a image, but the 2nd file can be a pdf or zip/rar file.
Most of them are pdf tough.
Hopefully can point me in the right direction with this as i got no clue anymore...
Why don't you simply save the files directly?
Do you need to open them in a different tab?
TAG POS=1 TYPE=IMG ATTR=HREF:http://*.jpg CONTENT=EVENT:SAVEITEM
TAG XPATH="/html/body/div[1]/form/div[3]/div/h2/span[2]/a[1]" CONTENT=EVENT:SAVETARGETAS
or something like that depending on what you have there.
I prefer to refer items by XPATH, but that's just me

imacros relative positioning in cell

I'm trying to use imacros on this site: http://www.philsp.com/homeville/FMI/t/t363.htm#A7331 to find the covers and publication info for short stories I have in my collection. I have my code working OK except for extracting the publication info at the top of the cells.
In this example my code has searched and found: "Simple Gifts" by "Maya Kaathryn Bohnhoff", and saved the cover. I now want it to go to the top of the cell and save the publication info, which in this example is: "Analog Science Fiction and Fact [v130 # 1 & 2, January/February 2010]"
Whatever I try jumps to the top of the top cell on the page. Can anyone help me out with this.
Thanks.
VERSION BUILD=8031994
TAB T=1
SET !ERRORIGNORE YES
URL GOTO=http://www.philsp.com/homeville/FMI/t/t363.htm#A7331
TAG POS=1 TYPE=LI ATTR=TXT:*Simple<SP>Gifts*
ONDOWNLOAD FOLDER=C:\Covers FILE=cover.jpg WAIT=YES
TAG POS=R1 TYPE=A ATTR=HREF:*http://www.philsp.com/data/images*.jpg CONTENT=EVENT:SAVETARGETAS
EDIT:
This seems to work as the popup shows the correct text to extract but the saveas still saves the text from the very top of the page. I dont understand why, any ideas?
URL GOTO=http://www.philsp.com/homeville/FMI/t/t363.htm
SET title *Simple<SP>Gifts*
TAG POS=1 TYPE=UL ATTR=TXT:{{title}} EXTRACT=TXT SEARCH SOURCE=REGEXP:"<a.+><i>(.+)\].+" EXTRACT="$1"
SET !EXTRACT_TEST_POPUP YES
SAVEAS TYPE=EXTRACT FOLDER=C:\imacros FILE=results.csv
Perhaps, the following code would be helpful:
SET title *Simple<SP>Gifts*
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=UL ATTR=TXT:{{title}} EXTRACT=TXT
SET info EVAL("var s = \"{{!EXTRACT}}\".match(/\\n(.*)\\n/)[1]; s;")

how to write .iim file for imacros

VERSION BUILD=6060703 RECORDER=CR
URL GOTO=URL
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
WAIT SECONDS=6
This is the code I'm using for .iim file to click on a button on a website. But I couldn't understand what this code is and what are those tag pos and button attr. When I run this code there's an error like this.
RuntimeError: element INPUT specified by * was not found, line: 3
What is this error and how to tackle it. Please help.
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
This is a button that submits something. Find that button on web page. Right click on it and select "Inspect Element". Then you will see HTML code of that button.
If it has property name="somename" or id="someid" then you will put
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:somename
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:someid

Imacros help, script was working but not now

This line was working before but now it doesn't extract the text, I guess this is happening because it is clicking inside the box. This only happen when I use Firefox, using Internet Explorer is ok.
VERSION BUILD=8021970
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:emailForm ATTR=ID:fName&&VALUE:* EXTRACT=TXT
it looks like the value you need is disappear when imacros tries to scrape it, but you can use this code to get email:
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=span attr=id:cxtEmail EXTRACT=TXT
or you can scrape htm of your tag and parse it to get value attribute

Extracting data from a website using iMacros

I am really new to iMacros but seem to have a basic understanding of how it works. However, I have two problems that I just can't seem to resolve. The iMacros loads from and executable service that is ran whenever needed to get information. Once the data is extracted the service takes it and writes it to a file on the servers C drive. This has been working fine up till about a month ago. Amazon changed the website and now I can't get the script to cooperate. All help resolving this would be greatly appreciated.
The script does not extract the text, and
A new iMacros browser opens after each run-through of the script.
I have researched the internet, manipulated the script many different ways, and I have used the record option, as well as the wizard to create the script to extract the data. I'm not sure what I am missing. My script is below.
VERSION BUILD=7401598
TAB T=1
URL GOTO=https://sellercentral.amazon.com/gp/fba/revenue-calculator/index.html/ref=au_xx_cont_xx?ie=UTF8&lang=en_US
WAIT SECONDS=10
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:search-form ATTR=ID:search-string CONTENT={{Asin}}
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling
WAIT SECONDS=10
The text I need to extract is Order handling, Pick & Pack, Weight Handling.
You should try placing EXTRACT=TXT after the commands. Also check the html of page and make a command if record doesn't work. If for example you have a link on a page this would be it's HTML code.
click me
iMacros to extract link and text from this are.
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=HREF
There are few other variations but this is the main part. In your case this would be the proper code.
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
Try it and please use iMacros FireFox addon for this.
Edit:
You can declare one scraping macro in JavaScript.
var macroScrape;
macroScrape ="CODE:";
macroScrape +="TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT";
iimPlay(macroScrape)
var text=iimGetLastExtract();
alert(text);
I use only once EXTRACT command in once macro. If I need more info scraped I use more macro codes declared as a variable in the example above. This could work if you know how to use it.
iMacros support is sometimes really slow.