theninjamanz 29 Posted August 28, 2010 Report Share Posted August 28, 2010 I have scraped a list of URLs, but I want to remove any URL from a specific domain. Example: google.com/qwerqwere.htmlgooge.com/o121302.htmlbob.com/yeay I would like to remove all teh domains that have Google from the list. I have tried doing a few things, but it seems that you can't wildcard it. HELP!! Quote Link to post Share on other sites
BigEfromDaBX 25 Posted March 10, 2017 Report Share Posted March 10, 2017 Does anyone know how to do this? Quote Link to post Share on other sites
deliter 203 Posted March 10, 2017 Report Share Posted March 10, 2017 Really sucks that ubot has to declare all lists before runtime, and custom functions cannot return a list or even as a parameter argument, Ubot should be smart enough to know its returning a Ubot list in the function, I have reported this years ago and was informed it is not a bug, and to place a feature request however this should be what your looking for define $ListRemove(#list, #query) { add list to list(%TheList,$list from text(#list,$new line),"Don\'t Delete","Local") set(#position,$subtract($list total(%TheList),1),"Local") loop($list total(%TheList)) { if($contains($list item(%TheList,#position),#query)) { then { remove from list(%TheList,#position) decrement(#position) } else { decrement(#position) } } } return(%TheList) } add list to list(%URLs,$list from text("google.com/qwerqwere.html googe.com/o121302.html bob.com/yeay",$new line),"Don\'t Delete","Global") add list to list(%CleanedList,$list from text($ListRemove(%URLs, "google.com"),$new line),"Don\'t Delete","Global") 2 Quote Link to post Share on other sites
BigEfromDaBX 25 Posted March 10, 2017 Report Share Posted March 10, 2017 Thanks @deliter. You always come to the rescue. I figured it out right after. I did mine a little different. I loaded the list and did the if $contains deal and whatever was true I added it to another list. Then at the end I took the two lists and made a third list from using the $subtract lists You rock. 2 Quote Link to post Share on other sites
Code Docta (Nick C.) 639 Posted March 11, 2017 Report Share Posted March 11, 2017 Here is another way, comment("you can use a $read file function to read in the file of urls or use a variable insted put in place of urls inside \"Original Text\" also use a #varible in place of the root domain or use $next list item #var.* The . is a character and the star is to the end of the line.") clear list(%urls) add list to list(%urls,$list from text($replace regular expression("google.com/qwerqwere.html googe.com/o121302.html bob.com/yeay google.com/sbljdlekjlj","google.com.*",$nothing),$new line),"Delete","Global") alert(%urls) comment("can look like this") set(#domain to remove,"google.com","Global") clear list(%urls_2) add list to list(%urls_2,$list from text($replace regular expression("google.com/qwerqwere.html googe.com/o121302.html bob.com/yeay google.com/sbljdlekjlj","{#domain to remove}.*",$nothing),$new line),"Delete","Global") alert(%urls_2) Regards,Nickremove url from list.ubot 2 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.