How to extract certain links and assign them to an array variable?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
layperson
Posts: 2
Joined: Sun Nov 17, 2019 5:26 am

How to extract certain links and assign them to an array variable?

Post by layperson » Sun Nov 17, 2019 6:44 am

Hi. I am new to iMacros.

I use Windows 10, iMacros 12.0.1.171 Enterprise trial version, chrome 78.0.x

Any help will be greatly appreciated!

I want to do something very simple but don't know how to do this.


I want to extract all the links having a certain word in a web page.

For example, I want to extract all the links having 'JCC' like below:

1) http://JCC.domain-name.com/any_number_or_letter_or_whatever
2) http://JCC.domain-name.com/any_number_or_letter_or_whatever
3) http://JCC.domain-name.com/any_number_or_letter_or_whatever

... and so on

After extracting all the links above, I want to move to each web page one by one or randomly.

I mean, after visiting the first page, I want do something, and then, I want to move to the 2nd web page, and then wait for 7 seconds, using 'WAIT SECONDS=7' command, to load the web page completely, and I want to do something... and so on.

I must not visit the web page I had already paid a visit.

Q1) How can I assign each link having a certain word to an array? How can I assign all the links to an array AT RANDOM or FROM TOP-TO-BOTTOM OF THE HTML PAGE?

Q2) How can I move to each web page using the array variable?

Sometimes, the web page doesn't show all the links having 'JCC's, so I might have to hit the F5 key to refresh the web page.

Sometimes I get no new link, sometimes 5 or 10 new links which were not displayed before reloading the web page.

There is no way to know how many times I have to reload the web page but I guess 2 to 5 would be good.

Q3) I want to add all the new links from the reloaded the web page to the previous array. How can I do this?


[Q4] I might have to use this macro later again. Then, I must NOT revisit the web page I'd already visited. How can I make iMacros do this?

Thank you very much in advance. : )
Last edited by layperson on Sun Nov 17, 2019 7:05 pm, edited 3 times in total.
chivracq
Posts: 9508
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to extract certain links and assign them to an array variable?

Post by chivracq » Sun Nov 17, 2019 7:04 am

layperson wrote:
Sun Nov 17, 2019 6:44 am
Hi. I am new to iMacros.

Any help will be greatly appreciated!

I want to do something very simple but don't know how to do this.


I want to extract all the links having a certain word in a web page.

For example, I want to extract all the links having 'JCC' like:

1) http://JCC.domain-name.com/any_number_or_letter_or_whatever
2) http://JCC.domain-name.com/any_number_or_letter_or_whatever
3) http://JCC.domain-name.com/any_number_or_letter_or_whatever

... and so on

After extracting all the links above, I want to move to each web page one by one or at random

I mean, after visiting the first page, I want do something, and then, I want to move to the 2nd web page, and then wait for 7 seconds, using 'WAIT SECONDS=7' command, until the web page is fully loaded, and I want to do something... and so on.

I must not visit the web page I had already paid a visit.

Q1) How can I assign each link having a certain word to an array? How can I assign all the links to an array AT RANDOM or FROM TOP-TO-BOTTOM OF THE HTML PAGE?

Q2) How can I move to each web page using the array variable?

Sometimes, the web page doesn't show all the links having 'JCC's, so I might have to hit the F5 key to reload the web page.

Sometimes I can get 0 link, sometimes 5 to 10 more new links. I don't know how many times I have to reload the web page but I guess 2 to 5 would be good.

Q3) I want to add all the new links from the reloaded the web page to the previous array. How can I do this?


[Q4] I might have to use this macro later again. Then, I must NOT revisit the web page I'd already visited. How can I make iMacros do this?

Thank you very much in advance. : )

Read (and follow) the Forum Rules for me to read... :idea:
=> CIM...! :mrgreen: (Read my Sig...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
layperson
Posts: 2
Joined: Sun Nov 17, 2019 5:26 am

Re: How to extract certain links and assign them to an array variable?

Post by layperson » Sun Nov 17, 2019 7:20 pm

Hi.

Right after posting my question here, it just flashed across my mind that I forgot to write down things you mentioned.

I wanted to edit my post but I couldn't do that. I edited the original post, so that you can check them out.

Thank you very much.
chivracq
Posts: 9508
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to extract certain links and assign them to an array variable?

Post by chivracq » Mon Nov 18, 2019 2:59 am

layperson wrote:
Sun Nov 17, 2019 7:20 pm
Hi.

Right after posting my question here, it just flashed across my mind that I forgot to write down things you mentioned.

I wanted to edit my post but I couldn't do that. I edited the original post, so that you can check them out.

Thank you very much.
I use

Code: Select all

Windows 10, iMacros 12.0.1.171 Enterprise trial version, chrome 78.0.x
Hum, OK, but your FCI is still completely unclear, there is no v12.0 TRIAL Version for iMB anymore, that Version was from 2 or 3 years ago, even v12.5 is already at least 1 year old, current Version is now v12.6.

+ If using CR, you also need to mention which iMacros Version you'll be using...! (Even if I already know it's probably v10.0.5 'Free'...)

Your parallel Thread on SOF is nearly clearer about your FCI, even if containing some contradictory Info:
- Assigning links having a certain word to an array using iMacros
I use

Code: Select all

Windows 10, iMacro 12.6.
>>>

No Need for the big Quote of yourself again in your previous Post, you can't delete anymore, I'll have to ask the Forum Admin to do so... :roll:

>>>

This was a quick Reply, I'm eating the last 100Mb from my Int. Co. Abo to reply to this one, back on Internet probably We. of Th. next week... :oops:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply