Jump to content
UBot Underground

looping a scrape and nothing to scrape


Recommended Posts

I was scraping a site , every thing was going fine when the site had a hiccup and left me with nothing to scrape. how is this handled by you pros?

I know now that i have to put in a a test to make sure that the target of the scrape is actually there?

But if it isn't how do I make the loop start over?

or

do I put in a javascript to reload the page and hope that it reloads the proper page?

Link to post
Share on other sites

Hi,

 

Sample code:

set(#checkedpagedata, "false", "Global")
set(#checkedpagedatacount, 0, "Global")
loop while($comparison(#checkedpagedata, "=", "false")) {
if($exists(<innertext="5 star">)) {
 then {
	 set(#checkedpagedata, "true", "Global")
 }
 else {
	 if($comparison(#checkedpagedatacount, ">=", 9)) {
		 then {
			 run javascript("window.location.reload()")
			 wait for element(<innertext="5 star">, 30, "Appear")
			 set(#checkedpagedatacount, 0, "Global")
		 }
		 else {
		 }
	 }
	 wait(1)
	 increment(#checkedpagedatacount)
 }
}
}

 

Change these lines to a element on the webpage you are about to scrape. It will not get out of the loop until the element appears on the webpage.

if($exists(<innertext="5 star">)) {

wait for element(<innertext="5 star">, 30, "Appear")

 

sample-page-check-reload-001.ubot

 

Kevin

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...