Jump to content
UBot Underground

How To Deal With Empty Lines In A List?


Recommended Posts

I wanted to get someone's feedback on this.  I'm currently scraping multiple list that will be joined into one list.  However,

in one particular list that I'm scraping on some pages there may be for an example 95 items but for some reason Ubot

may only pick up 94 items.  

 

So my question is if for some reason there is not an item that could be scraped for that line item in the list

and instead of Ubot just skipping it is it possible to just put either a character or something in that space so that

it doesn't throw off my list and it gets skipped so that the list shows 95 items instead of 94 items?

 

I read about this in another thread that was dated years ago but there was no answer really given -

http://www.ubotstudio.com/forum/index.php?/topic/5319-if-scrape-empty-then-add-nothing/

 

 

So I was curious if any of you had any suggestions on how you would deal with empty spaces in your list when you want to 

have something in that space to fill that particular line within that list?

 

I would greatly appreciate any suggestions. 

 

 

Thank you,

 

 

mrwalt

Link to post
Share on other sites

Hi Kreatus,

 

Thank you so much for taking the time to provide your feedback.  I will definitely try this out here shortly.

 

Again thank you.

 

 

mrwalt

Link to post
Share on other sites

Here is another option:

set(#list pos, 0, "Global")
loop($list total(%base list)) {
    if($comparison($list item(%base list, #list pos), "=", $nothing)) {
        then {
            remove from list(%base list, #list pos)
            decrement(#list pos)
        }
    }
    increment(#list pos)
}
Link to post
Share on other sites

Here is another variation.

load html("<p><a class=\"example\" href=\"http://www.website1.com\">www.website1.com</a></p>
<p><a class=\"example\" href=\"http://www.website2.com\">www.website2.com</a></p>
<p><a class=\"example\" href=\"http://www.website3.com\">www.website3.com</a></p>
<p><a class=\"example\" href=\"\"></a></p>
<p><a class=\"example\" href=\"http://www.website4.com\">www.website4.com</a></p>
<p><a class=\"example\" href=\"http://www.website5.com\">www.website5.com</a></p>
<p><a class=\"example\" href=\"http://www.website6.com\">www.website6.com</a></p>
")
add list to list(%list1, $scrape attribute(<class="example">, "innertext"), "Delete", "Global")
set(#var, %list1, "Global")
set(#var, $replace(#var, "

", "
"), "Global")
clear list(%list1)
add list to list(%list1, $list from text(#var, "
"), "Delete", "Global")
set(#var, "", "Global")

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...