nubot 1 Posted April 19, 2016 Report Share Posted April 19, 2016 To clarify what I mean, say I wanted to pull up some Google search results and then save the URL of only specific sites, is there a way to allow for user interaction with the browser? e.g. 1. Load up a Google search page for "widgets"2. You get your search results: widget site 1widget site 2...widget site 3.. etc. Would there be a way to allow the user to click either directly on the link and have it added to a list, or would there be a way to include a UI element such as a button that the person could click to "add url" to a list? Add site 1 & 2 but not 3. Thanks in advance! Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted April 19, 2016 Report Share Posted April 19, 2016 define actions needed for each widget as your calling it. then call each define via ui buttons, this way it can process those actions as needed. to load up the bot with a specific page, you can use onload to navigate to the page needed on load, or can use the compile option to set starting page. Quote Link to post Share on other sites
jomark3 25 Posted April 19, 2016 Report Share Posted April 19, 2016 To clarify what I mean, say I wanted to pull up some Google search results and then save the URL of only specific sites, is there a way to allow for user interaction with the browser? e.g. 1. Load up a Google search page for "widgets"2. You get your search results: widget site 1widget site 2...widget site 3.. etc. Would there be a way to allow the user to click either directly on the link and have it added to a list, or would there be a way to include a UI element such as a button that the person could click to "add url" to a list? Add site 1 & 2 but not 3. Thanks in advance!I created a similar program when we were looking to buy a boat. With a few modifications, you can modify it to suit your needs. Click the 'Start' button and the bot searches craigslist boats that meet our criteria, then saves all of the urls to a list. It then visits each url so you can see the item. If you click on the 'Next' button, it visits the next item. If you click on the 'Log This Boat' button, it saves the url (along with some other info on that boat,.If you want to review all of the boats you saved, click on the 'Save This List' button. Note: This bot was created using version 4 and uses the ui html panel, (not available in the Ubot standard version), but it would work equally well in a load html node. ui html panel("<html><head> <style type=\\\"text/css\\\">.Get_Data \\\{ font-family:arial; color:#ffffff; font-size:15px; font-weight:bold; padding:6px 24px; -moz-box-shadow:inset 0px 1px 10px #ffffff; box-shadow:inset 0px 1px 10px #ffffff; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #0000cc) ); background:-moz-linear-gradient( center top, #dfdfdf 5%, #0000cc 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\\\'#dfdfdf\\\', endColorstr=\\\'#0000cc\\\'); background-color:#dfdfdf; -moz-border-radius:21px; -webkit-border-radius:21px; border-radius:21px; border:1px solid #dcdcdc; display:inline-block; text-shadow:1px 1px 0px #777777;\\\}<!----.Get_Data:hover \\\{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #0000cc), color-stop(1, #dfdfdf) ); background:-moz-linear-gradient( center top, #0000cc 5%, #dfdfdf 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\\\'#0000cc\\\', endColorstr=\\\'#dfdfdf\\\'); background-color:#0000cc;\\\}----> </style><style type=\"text/css\">.Continue \{ font-family:arial; color:#000000; font-size:15px; font-weight:Bold; padding:6px 24px; -moz-box-shadow:inset 0px 0px 0px #ffff03; box-shadow:inset 0px 0px 0px #ffff03; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #FFFF03) ); background:-moz-linear-gradient( center top, #ededed 5%, #FFFF03 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#FFFF03\'); background-color:#0000cc; -moz-border-radius:21px; -webkit-border-radius:21px; border-radius:21px; border:1px solid #0000cc; display:inline-block; text-shadow:1px 1px 0px #ffffff;\}.Continue:hover \{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #FFFF03), color-stop(1, #ededed) ); background:-moz-linear-gradient( center top, #FFFF03 5%, #ededed 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFF03\', endColorstr=\'#ededed\'); background-color:#0000cc;\} </style> <style type=\"text/css\">.Generate-Code \{ font-family:arial; color:#000000; font-size:15px; font-weight:Bold; padding:6px 24px; -moz-box-shadow:inset 0px 1px 10px #ffffff; -webkit-box-shadow:inset 0px 1px 10px #ffffff; box-shadow:inset 0px 1px 10px #ffffff; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #cc0000) ); background:-moz-linear-gradient( center top, #ededed 5%, #cc0000 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#cc0000\'); background-color:#ededed; -moz-border-radius:0px; -webkit-border-radius:0px; border-radius:0px; border:1px solid #dcdcdc; display:inline-block; text-shadow:1px 1px 0px #ffffff;\}.Generate-Code:hover \{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cc0000), color-stop(1, #ededed) ); background:-moz-linear-gradient( center top, #cc0000 5%, #ededed 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#cc0000\', endColorstr=\'#ededed\'); background-color:#ededed;\}</style></head><body><button class=\"Get_Data\" onclick=\"ubot.runScript(\'Clear Variables()\')\">Start</button><br><button class=\"Continue\" onclick=\"ubot.runScript(\'NextItem()\')\">Next Item</button><br><button class=\"Generate-Code\" onclick=\"ubot.runScript(\'Log This Boat()\')\">Log This Boat</button><br> <button class=\"Generate-Code\" onclick=\"ubot.runScript(\'Email List()\')\">Save This List</button></center><br> </body></html>", 200)Clear Variables()define Clear Variables { set(#itemnumber, 0, "Global") set(#URLNumber, 0, "Global") clear list(%urls) clear list(%boats1) clear list(%Boats To Check) Get URLs()}define Get URLs { set user agent("Firefox 6") allow popups("Yes") navigate("http://jerseyshore.craigslist.org/search/boo?max_price=4000&min_boat_length_overall=18&max_boat_length_overall=21&boat_propulsion_type=2", "Wait") wait(2) add list to list(%boats1, $scrape attribute(<innertext=w"*">, "fullhref"), "Delete", "Global") set(#itemnumber, 21, "Global") loop($subtract($list total(%boats1), 31)) { add item to list(%urls, $list item(%boats1, #itemnumber), "Delete", "Global") increment(#itemnumber) } set(#URLNumber, 0, "Global") Boat Data()}define Boat Data { navigate($list item(%urls, #URLNumber), "Don\'t Wait")}define NextItem { increment(#URLNumber) Boat Data()}define Log This Boat { add item to list(%Boats To Check, $url, "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"postingtitletext\">", " - <span class=\"price\">"), "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"price\">", "</span>"), "Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"price\">", "</span>"), "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<small>", "</small>"), "Don\'t Delete", "Global") wait for element(<class="reply_options">, "", "Appear") add item to list(%Boats To Check, "- - - - - - - - ", "Don\'t Delete", "Global")}define Email List { save to file("Boat-List.txt", %Boats To Check)} 2 Quote Link to post Share on other sites
nubot 1 Posted April 19, 2016 Author Report Share Posted April 19, 2016 define actions needed for each widget as your calling it. then call each define via ui buttons, this way it can process those actions as needed. to load up the bot with a specific page, you can use onload to navigate to the page needed on load, or can use the compile option to set starting page. Sorry this flew over my head and I can't make any sense of it :/ I created a similar program when we were looking to buy a boat. With a few modifications, you can modify it to suit your needs. Click the 'Start' button and the bot searches craigslist boats that meet our criteria, then saves all of the urls to a list. It then visits each url so you can see the item. If you click on the 'Next' button, it visits the next item. If you click on the 'Log This Boat' button, it saves the url (along with some other info on that boat,.If you want to review all of the boats you saved, click on the 'Save This List' button. Note: This bot was created using version 4 and uses the ui html panel, (not available in the Ubot standard version), but it would work equally well in a load html node. ui html panel("<html><head> <style type=\\\"text/css\\\">.Get_Data \\\{ font-family:arial; color:#ffffff; font-size:15px; font-weight:bold; padding:6px 24px; -moz-box-shadow:inset 0px 1px 10px #ffffff; box-shadow:inset 0px 1px 10px #ffffff; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #0000cc) ); background:-moz-linear-gradient( center top, #dfdfdf 5%, #0000cc 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\\\'#dfdfdf\\\', endColorstr=\\\'#0000cc\\\'); background-color:#dfdfdf; -moz-border-radius:21px; -webkit-border-radius:21px; border-radius:21px; border:1px solid #dcdcdc; display:inline-block; text-shadow:1px 1px 0px #777777;\\\}<!----.Get_Data:hover \\\{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #0000cc), color-stop(1, #dfdfdf) ); background:-moz-linear-gradient( center top, #0000cc 5%, #dfdfdf 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\\\'#0000cc\\\', endColorstr=\\\'#dfdfdf\\\'); background-color:#0000cc;\\\}----> </style><style type=\"text/css\">.Continue \{ font-family:arial; color:#000000; font-size:15px; font-weight:Bold; padding:6px 24px; -moz-box-shadow:inset 0px 0px 0px #ffff03; box-shadow:inset 0px 0px 0px #ffff03; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #FFFF03) ); background:-moz-linear-gradient( center top, #ededed 5%, #FFFF03 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#FFFF03\'); background-color:#0000cc; -moz-border-radius:21px; -webkit-border-radius:21px; border-radius:21px; border:1px solid #0000cc; display:inline-block; text-shadow:1px 1px 0px #ffffff;\}.Continue:hover \{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #FFFF03), color-stop(1, #ededed) ); background:-moz-linear-gradient( center top, #FFFF03 5%, #ededed 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFF03\', endColorstr=\'#ededed\'); background-color:#0000cc;\} </style> <style type=\"text/css\">.Generate-Code \{ font-family:arial; color:#000000; font-size:15px; font-weight:Bold; padding:6px 24px; -moz-box-shadow:inset 0px 1px 10px #ffffff; -webkit-box-shadow:inset 0px 1px 10px #ffffff; box-shadow:inset 0px 1px 10px #ffffff; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #cc0000) ); background:-moz-linear-gradient( center top, #ededed 5%, #cc0000 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#cc0000\'); background-color:#ededed; -moz-border-radius:0px; -webkit-border-radius:0px; border-radius:0px; border:1px solid #dcdcdc; display:inline-block; text-shadow:1px 1px 0px #ffffff;\}.Generate-Code:hover \{ background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cc0000), color-stop(1, #ededed) ); background:-moz-linear-gradient( center top, #cc0000 5%, #ededed 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#cc0000\', endColorstr=\'#ededed\'); background-color:#ededed;\}</style></head><body><button class=\"Get_Data\" onclick=\"ubot.runScript(\'Clear Variables()\')\">Start</button><br><button class=\"Continue\" onclick=\"ubot.runScript(\'NextItem()\')\">Next Item</button><br><button class=\"Generate-Code\" onclick=\"ubot.runScript(\'Log This Boat()\')\">Log This Boat</button><br> <button class=\"Generate-Code\" onclick=\"ubot.runScript(\'Email List()\')\">Save This List</button></center><br> </body></html>", 200)Clear Variables()define Clear Variables { set(#itemnumber, 0, "Global") set(#URLNumber, 0, "Global") clear list(%urls) clear list(%boats1) clear list(%Boats To Check) Get URLs()}define Get URLs { set user agent("Firefox 6") allow popups("Yes") navigate("http://jerseyshore.craigslist.org/search/boo?max_price=4000&min_boat_length_overall=18&max_boat_length_overall=21&boat_propulsion_type=2", "Wait") wait(2) add list to list(%boats1, $scrape attribute(<innertext=w"*">, "fullhref"), "Delete", "Global") set(#itemnumber, 21, "Global") loop($subtract($list total(%boats1), 31)) { add item to list(%urls, $list item(%boats1, #itemnumber), "Delete", "Global") increment(#itemnumber) } set(#URLNumber, 0, "Global") Boat Data()}define Boat Data { navigate($list item(%urls, #URLNumber), "Don\'t Wait")}define NextItem { increment(#URLNumber) Boat Data()}define Log This Boat { add item to list(%Boats To Check, $url, "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"postingtitletext\">", " - <span class=\"price\">"), "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"price\">", "</span>"), "Delete", "Global") add item to list(%Boats To Check, $page scrape("<span class=\"price\">", "</span>"), "Don\'t Delete", "Global") add item to list(%Boats To Check, $page scrape("<small>", "</small>"), "Don\'t Delete", "Global") wait for element(<class="reply_options">, "", "Appear") add item to list(%Boats To Check, "- - - - - - - - ", "Don\'t Delete", "Global")}define Email List { save to file("Boat-List.txt", %Boats To Check)} I will play around with this, thank you for sharing your script!! 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.