scrapelicious 0 Posted March 31, 2018 Report Share Posted March 31, 2018 (edited) Hi Everyone, I'm still a big noob with Ubot but I'm trying to make it work the best as I can. I took most uBot tutorials but was not able to find how to resolve the next, can someone help me or guide me to a video/guide that shows me how I can do it? Case: I want the bot to check the number of views a channel admin has, then if the number of views, for instance, are below 100.000 I want to send them a message. If the number is above 100k it needs to go to the next list item. The message part I figured out, but not how to create a way to see the views properly and do a sort of comparison with it so I can explain the uBot that it needs to send the message or skip the channel.. Who can help? The views can be found on the About page of a channel. Here an example of a YouTube About Page: https://www.youtube.com/channel/UCbBnnIbgqSwtXfVKug8PUjg/about?disable_polymer=1 The outcome when I scrape the views attribute is this: <b> 6,687,063 <b> views Can you also tell/explain how I only get the views and not all the other jibberish information? * I wanted to add the code but I can't because the website gives me an error message that my account is blocked or something? Edited March 31, 2018 by scrapelicious Quote Link to post Share on other sites
tinku 6 Posted March 31, 2018 Report Share Posted March 31, 2018 (edited) Do not try in that way ,try with http plugin if you don't want to buy it then try heopas http plugin it's free and going to serve your purpose. First scrape html document >> store in a variable >> use regex to find views .set condition if( views<10k){send mesage}else{navigate(go to next list item)}like thathope it helps youpm skype id- live:69f5974a7e15e93e Edited March 31, 2018 by tinku Quote Link to post Share on other sites
scrapelicious 0 Posted April 1, 2018 Author Report Share Posted April 1, 2018 That's a great answer, many thanks!Will look into this today Quote Link to post Share on other sites
stanf 43 Posted April 3, 2018 Report Share Posted April 3, 2018 navigate("https://www.youtube.com/channel/UCbBnnIbgqSwtXfVKug8PUjg/about?disable_polymer=1","Wait")set(#raw veiws,$scrape attribute(<innerhtml=w" • <b>*</b> views">,"innertext"),"Global")set(#final number,$find regular expression(#raw veiws,".(?<=.*\\s).*(?=\\sviews)"),"Global")if($comparison(#final number,"> Greater than",15000000)) { then { alert("greater") } else { alert("less") }} 1 Quote Link to post Share on other sites
tinku 6 Posted April 3, 2018 Report Share Posted April 3, 2018 navigate("https://www.youtube.com/channel/UCbBnnIbgqSwtXfVKug8PUjg/about?disable_polymer=1","Wait")set(#raw veiws,$scrape attribute(<innerhtml=w" • <b>*</b> views">,"innertext"),"Global")set(#final number,$find regular expression(#raw veiws,".(?<=.*\\s).*(?=\\sviews)"),"Global")if($comparison(#final number,"> Greater than",15000000)) { then { alert("greater") } else { alert("less") }}you can also try with xpath download heopas free plugin and try with that because ubot browser is not so stable the code like this:-set(#xpath,$plugin function("XpathPlugin.dll", "$Generic Xpath Parser", $document text, "x://*[@id=\"browse-items-primary\"]/li/div/div[3]/div/span[2]/b", "innerhtml", ""),"Global")and follow the logic as suggested by stanf 1 Quote Link to post Share on other sites
stanf 43 Posted April 3, 2018 Report Share Posted April 3, 2018 i did not take into account the unstable nature of ubots browser ( i use xbrowser), i also use xpath builder both by dan (http://network.ubotstudio.com/forum/index.php/user/1200-bot-factory-dan/ ) also regex builder by helloinsomnia ( http://network.ubotstudio.com/forum/index.php/user/4934-helloinsomnia/).save your pennies and grab all three items they will make your life easier.ps.this xpath code is shorter(//span[contains(@class,"about-stat")])[2]there are 3 classes "about-stat"adding the Prentiss around the code and the brackets with the 2 in the middle helps identify the second one, tinku codes his xpath by hand (i aint that smart), but both will grab the data that you want 1 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.