mrwalt 34 Posted March 17, 2014 Report Share Posted March 17, 2014 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 Ubotmay 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 listand instead of Ubot just skipping it is it possible to just put either a character or something in that space so thatit 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 Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted March 17, 2014 Report Share Posted March 17, 2014 What I did when my list have an empty line is create a loop and add item to a new list.Make the bot to add only items that isnt blank by adding an if/else command Quote Link to post Share on other sites
mrwalt 34 Posted March 18, 2014 Author Report Share Posted March 18, 2014 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 Quote Link to post Share on other sites
darryl561 177 Posted March 18, 2014 Report Share Posted March 18, 2014 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) } Quote Link to post Share on other sites
mrwalt 34 Posted March 18, 2014 Author Report Share Posted March 18, 2014 Thank you again as both work and are very helpful. mrwalt Quote Link to post Share on other sites
UBotBuddy 331 Posted March 19, 2014 Report Share Posted March 19, 2014 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") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.