Extract & Verify

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Extract & Verify

by vin on Wed Apr 12, 2017 8:28 am

Is there a way to extract a particular data from web page & compare it with a predefined values to return True or False
[ iMacros 11.5.499.3066 + IE 11 + Windows 10 ]
vin
 
Posts: 4
Joined: Wed Apr 12, 2017 8:25 am

Re: Extract & Verify

by chivracq on Wed Apr 12, 2017 8:51 am

vin wrote:Is there a way to extract a particular data from web page & compare it with a predefined values to return True or False

Hum..., low Quality Thread... :idea:
=CIM...! :mrgreen: (read my Sig...)

To answer your Qt, => yep, use 'EXTRACT' and 'EVAL()'...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6304
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Extract & Verify

by vin on Wed Apr 12, 2017 9:09 am

CIM: iMacros + IE11+ Windows 10

:lol: Thanks!
[ iMacros 11.5.499.3066 + IE 11 + Windows 10 ]
vin
 
Posts: 4
Joined: Wed Apr 12, 2017 8:25 am

Re: Extract & Verify

by chivracq on Wed Apr 12, 2017 9:23 am

vin wrote:CIM: iMacros + IE11+ Windows 10

:lol: Thanks!

Yeah, iMacros Version Version still missing..., v11.5 I reckon... :roll:

And you are expected to share your Solution once you've got your Script working...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6304
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Extract & Verify

by vin on Wed Apr 12, 2017 10:27 am

Great!

Manipulated extracted string using EVAL
SET !EXTRACT EVAL("var s=\"{{!EXTRACT}}\"; if (s.indexOf('Not Paid') > 0) {s += ', -> OK'} else {s += ', -> Failed'} ")
[ iMacros 11.5.499.3066 + IE 11 + Windows 10 ]
vin
 
Posts: 4
Joined: Wed Apr 12, 2017 8:25 am

Re: Extract & Verify

by vin on Wed Apr 12, 2017 10:29 am

Also I am doing SAVEAS to save multiple extractions in CSV, But they get added in a single row of CSV.

Is there way to add them in single column without writing additional string manipulation code?
[ iMacros 11.5.499.3066 + IE 11 + Windows 10 ]
vin
 
Posts: 4
Joined: Wed Apr 12, 2017 8:25 am

Re: Extract & Verify

by chivracq on Wed Apr 12, 2017 7:14 pm

vin wrote:Great!

Manipulated extracted string using EVAL
SET !EXTRACT EVAL("var s=\"{{!EXTRACT}}\"; if (s.indexOf('Not Paid') > 0) {s += ', -> OK'} else {s += ', -> Failed'} ")

Code: Select all
[ iMacros 11.5.499.3066 + IE 11 + Windows 10 ]

Finally OK for FCI, eh-eh...!
But hum, FCI in your Sig denotes from a good Intention but still doesn't "free" you from hard-coding it in your OP when you open a Thread...
Explanation is that you only have one Dynamic Sig for the whole Forum, so your Sig changes for all your (previous) Threads as soon as you change it, and it will look very suspicious in 2027 that you were already using [iMacros v138 + IE349 on WinSuperGallaxy_v9999] back in 2017...!

OK, Thanks for sharing your Sol...!
Ah-ah..., good-good, I always forget about this Use of 'indexOf()>0', quite clever, I usually do the same with 'split()' (+'length')...

Mini-Feedback:
I consider "bad Practice" to do direct Manipulation on 'EXTRACT' for Debug Purpose, because if your 'EVAL()' Statement doesn't work directly, you cannot use 'PROMPT' to debug your Script, or you need to use several 'PROMPT's before and after the 'EVAL()' and save them manually in some Temp-TXT File, which is a bit of a hassle I would think...
=> I think it's better to do your Data-Manipulation on some Temp-Var and to reconstruct the Content of '!EXTRACT' at the last moment just before doing the 'SAVEAS'... Your 'indexOf()' Method for example could be completely "screwed" if you added some extra Extract before the last one..., hum, "my" 'split()' as well in your case, but I always "work" with 'EVAL()' on a "clean" Single Extract..., which allows me when adding some extra Extracts to only think about what I want to add at that moment and not have to worry about trying to decode what I might have wanted to do 1.5 years ago, which works of course, but shit, why the last 'EVAL()' produces some unexpected Result...!?
(OK, my Personal Opinion, based on my own Experience, for myself of course, but on debugging many-many Scripts from the Forum as well that were not written by me...)

vin wrote:Also I am doing SAVEAS to save multiple extractions in CSV, But they get added in a single row of CSV.

Is there way to add them in single column without writing additional string manipulation code?

One 'SAVEAS' = One Row in the '.CSV'...
=> Each time you want a new Row, fire a 'SAVEAS'... :idea:
(And the Content of '!EXTRACT' gets automatically emptied after each 'SAVEAS', you don't have to take care of it...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6304
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 4 guests

-->