Jump to content
UBot Underground

deliter

Fellow UBotter
  • Content Count

    603
  • Joined

  • Last visited

  • Days Won

    52

Posts posted by deliter

  1. heres another example

    plugin command("DeliterCSS.dll", "In New Browser Chrome", "") {
        plugin command("DeliterCSS.dll", "Navigate Chrome", "http://www.google.com/")
        plugin command("DeliterCSS.dll", "Chrome Wait For Element", "#lst-ib", 10)
        plugin command("DeliterCSS.dll", "Type Chrome", "#lst-ib", "ubot studio")
        plugin command("DeliterCSS.dll", "Click Chrome", "[value=\"Search\"]")
        plugin command("DeliterCSS.dll", "Chrome Wait For Element", "#foot", 10)
        alert($plugin function("DeliterCSS.dll", "Deliter CSS Selector", $plugin function("DeliterCSS.dll", "Chrome Page Source"), ".r a", "TextContent"))
        wait(20)
    }
    
    
  2. yes ok thank you for the tip, i will do, but this is no answer to my question :-)

     

    why isnt there just a "restart script" command? is hard to create such Thing?

     

    I'd suggest to read the forum, this question pops up from a newbie about every month, the reason it has been requested so much, and has never been implemented is because far better solutions already exist

  3. Hey

     

    Its pretty basic, I designed for my own use, will keep you posted if I add anything else or fix the things that do not work

     

    https://1drv.ms/u/s!AgO9AudYbciJheoHbEYsVRJrOkmn0w

     

    You will need to download the chromedriver.exe from 

    https://chromedriver.storage.googleapis.com/index.html

     

    and store it in C:\Program Files (x86)\UBot Studio 5

    plugin command("DeliterCSS.dll", "In New Browser Chrome", "") {
        plugin command("DeliterCSS.dll", "Navigate Chrome", "http://www.google.com/")
        plugin command("DeliterCSS.dll", "Chrome Wait For Element", "#lst-ib", 10)
        plugin command("DeliterCSS.dll", "Type Chrome", "#lst-ib", "Hello From Deliter!")
        wait(20)
    }
    
    
    • Like 5
  4. I havnt checked the site but heres a few things, I have checked the picture you uploaded

     

     

    set(#var0,$scrape attribute(<innertext=92>,"value"),"Global")

     

    this code is actually looking for an attribute called value, and not actually looking for the innertext inside the tag

     

    the code for this is <span>92</span>

     

    for the above code to work, the html would need to be <span value="SpanValue">92</span>

     

    the result of your above would be "SpanValue" as that is the value of the value attribute of the element that has an innertext of 92

     

    your code above needs to be 

     

    set(#var0,$scrape attribute(<innertext=92>,"innertext"),"Global")

     

    This code will only scrape if the innertext is 92, or any element with an innertext on 92, so it needs a better selector

     

     

    this should work, ubot can be pretty difficult if the elements are setup not very good, so for this it might be difficult with ubot

     

    In the code, I selected the id of the parent, 2 rows above the 92 value and used some functions to remove the whitespace, for this type of stuff like how you were using the devtools if you right click on the blue area, you can "copy element"(CSS) or "copy xpath" to that exact element, me and Dan both have free plugin for this, heres an example of simply using that right click in the web inspector and getting a path to the element, of course the plugins make this easier,ive changed the html slightly below but should work for your page too

    load html("<div id=\"total_contacts\">
     <p class=\"stat\">
     <span>92</span>
     </p>
     </div>")
    alert($trim($strip tags($scrape attribute(<id="total_contacts">,"outerhtml"))))
    define $CSS Selector(#CSS Path, #Attribute To Scrape) {
        return($eval("document.querySelector(\"{#CSS Path}\").{#Attribute To Scrape}"))
    }
    alert($CSS Selector("#total_contacts > .stat >span", "innerText"))
    
    
  5. if you want to make apps like ubot that have a web browser built in and you drive the web browser from outside of it, like Ubot, then C#, Ubot is also built on C# I think

     

    C# over Python, to elaborate on HelloInsomnias answer, the intellisense added by Visual Studio, is absolutely amazing, really really incredible

     

    I cannot code in C# but I built a Ubot plugin for it which is available to anyone here, the intellisense just guided me through, it tells me instantaneously why code will not work, and tells me what properties an object has, was an amazing experience, but it does look incredibly difficult,I still have no idea how it even works, I just put some code into the execute part of the template script provided by Ubot

     

    I would recommend JS to anybody, simply because its easy, hardest thing I find when starting a language is just setting up the development environment, with JS you click developer tools and console, and you can begin in 2 minutes

  6. thank alot

    it is amazing

     

    and i have a question , is there anyway to add a row ? and if there are many rows , it will show current row ?

    thank

     

    Nice ideas will add these features later today and also a way to dynamically insert a full html table from your Ubot Table too

     

    It appears Ubot has blocked me from starting threads in the free bots/plugins thread, so I am awaiting the outcome as to why this is

    • Like 1
  7. Heres a full replica, I have been meaning to make some UI Table commands for the community, I guess I might make a start on it, on this you can select the row, give it a color and a message, just like the UI above, and the delete button works too

    ui html panel("<!DOCTYPE html>
    <html lang=\"en\">
    <head>
      <title>Bootstrap Example</title>
      <meta charset=\"utf-8\">
      <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
      <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">
      <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>
      <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>
    
    <style>
    #tHeader\{
    color:white;
    background-color:#003366;
    \}
    
    .table td\{
        border: black solid 1px !important;
    \}
    
    #tBody\{
    
    color:white;
      background-color:#6699ff;
    
    \}
    
    .deleteR\{
    
    
      background-color:red;   
    \}
    
    </style>
    </head>
    <body>
    <input type=\"hidden\" id=\"invElem\" variable=\"#varThree\" onChange=\'evalUI()\' />
    <div id=\"yourDiv\"></div>
    <script>
    
    function evalUI()\{
    
    ubot.runScript(\'set(#UIOutput,\"\'+encodeURIComponent(eval(document.querySelector(\"#invElem\").value).toString())+\'\",\"Global\")\')
    \}
    
    </script>
    <div class=\"container\">
      <h2>Bordered Table</h2>
      <p>The .table-bordered class adds borders to a table:</p>            
      <table class=\"table table-bordered\">
        <thead id=\"tHeader\">
          <tr>
            <th>Job ID</th>
            <th>Campaign Name</th>
            <th>Date Added</th>
                <th>Next Run</th>
                    <th>\'# URL\'s</th>
                        <th>Campaign Status</th>
                        <th></th>
          </tr>
        </thead>
        <tbody id=\"tBody\">
          <tr>
            <td>7442</td>
            <td>Home Page</td>
            <td>11/04/2015</td>
             <td>11/04/2015</td>
              <td>1</td>
               <td>Submitting: Sending to Cloud</td>
               <td class=\"deleteR\" onClick=\"remove(this)\" >DELETE</td>
          </tr>
          <tr>
            <td>7442</td>
            <td>Home Page</td>
            <td>11/04/2015</td>
             <td>11/04/2015</td>
              <td>1</td>
               <td>Waiting: Drip Schedule</td>
                <td class=\"deleteR\" onClick=\"remove(this)\" >DELETE</td>
          </tr>
        <tr>
            <td>7442</td>
            <td>Home Page</td>
            <td>11/04/2015</td>
             <td>11/04/2015</td>
              <td>1</td>
               <td>Finished: Drip Schedule</td>
                <td class=\"deleteR\" onClick=\"remove(this)\" >DELETE</td>
          </tr>
        </tbody>
      </table>
    </div>
    
    <script>
    
    function remove(elem)\{
    
    $(elem.parentElement).remove()
    
    
    \}
      </script>
    
    </body>
    </html>
    ",300)
    define changeCampaignStatus(#row, #color, #Message) {
        set(#item,$add(#row,1),"Local")
        return($evalUI("$(\"#tBody > tr:nth-child({#item}) > td:nth-child(6)\")[0].textContent = \"{#Message}\"
    $(\"#tBody > tr:nth-child({#item}) > td:nth-child(6)\")[0].style.backgroundColor = \"{#color}\"
    "))
    }
    define $evalUI(#input) {
       set(#varThree,#input,"Global")
        wait(0.5)
       
        set(#varThree,"","Global")
    }
    wait(10)
    changeCampaignStatus(0, "green", "Submitting")
    wait(15)
    changeCampaignStatus(1, "orange", "Waiting")
    wait(10)
    changeCampaignStatus(2, "red", "Completed")
    
    
    • Like 6
  8. Wow! So, it worked, and quickly! For the purposes of what I am trying to do, it is a much better solution than my own initial channel scraping method (Which was bulky, convoluted, and did not work on large channels!). I have to edit a bit of this to get it to work within my script, but that is trivial and easy. This replaces my clunky solution with a far better one. I have added slightly edited code below that gets the href as opposed to the titles, for anyone who may need that also.

    usersVideos("https://www.youtube.com/user/YaleCourses/videos")
    define usersVideos(#videoPage) {
        set(#get,$plugin function("HTTP post.dll", "$http get", #videoPage, "", "", "", ""),"Local")
        add list to list(%titles,$plugin function("DeliterCSS.dll", "Deliter CSS Selector", #get, ".yt-lockup-title .yt-uix-sessionlink", "href"),"Don\'t Delete","Global")
        if($plugin function("DeliterCSS.dll", "Deliter CSS Selector Exists", #get, ".yt-uix-load-more")) {
            then {
                moreUserVideos("https://www.youtube.com{$plugin function("DeliterCSS.dll", "Deliter CSS Selector", #get, ".yt-uix-load-more", "data-uix-load-more-href")}")
            }
            else {
            }
        }
    }
    define moreUserVideos(#url) {
        set(#get,$plugin function("HTTP post.dll", "$http get", #url, "", "", "", ""),"Local")
        set(#removeEncoding,$eval("var re = {#get}
    re.content_html"),"Local")
        add list to list(%titles,$plugin function("DeliterCSS.dll", "Deliter CSS Selector", #removeEncoding, ".yt-lockup-title .yt-uix-sessionlink", "href"),"Delete","Global")
        set(#next,$replace regular expression($find regular expression(#get,"browse_ajax\\?.+?\""),"\\\\\"$",""),"Local")
        if($comparison(#next,">",$nothing)) {
            then {
                moreUserVideos("https://www.youtube.com/{$eval("var re = \"{#next}\"
    re")}")
            }
            else {
            }
        }
    }
    

    So, for posterity, I am going to attempt to break down what is happening here.

     

    1. usersVideos "videoPage" is the parameter variable of the define "usersVideos", allowing me to define the page. (can probably add a variable to this for UI input of a page)
    2. define usersVideos first sets the get function to the videoPage variable, then it adds the css selector attribute chosen to the list. (I altered my list name and selected href)
    3. Next, the if statement checks if the gotten page info has a "load more" css selector, and if it does, it goes to the YouTube URL along with the css selected attribute for the actual "load more".
    4. The define; "moreUserVideos" is used to (This is where I get lost! lol! I'm not sure what happens here or how it is related to the first define.)

     

    So far, I somewhat get what is going on and I know it works, so big thanks to you Deliter! I am just trying to wrap my mind around the rest, so as to better understand what is being done, to expand my own knowledge and skill. While the problem is indeed resolved by this, I also want to understand how that was achieved, so that I can work around similar problems in the future, without needing help. Hopefully this will also help others who are trying to create similar bots!

     

     

    Thanks man, very flattered you really appreciate it and are trying to learn from it, I like helping people, kind of sucks when someone just copy pastas your work, doesn't "like" the post, nor tries to learn from it

     

    the second part "moreUserVideos" is basically like if you were doing it manually, it hits the load more button, scrapes the titles, then the last thing is it checks if the load more button is present, if so, it keeps calling itself "moreUserVideos" to do that process again until the button is there no longer,if not present do nothing

     

    if you want to start learning CSS Selectors, which I would really recommend, I have a plugin for Chrome to help you write selectors automatically

     

    http://network.ubotstudio.com/forum/index.php/topic/20582-chrome-extension-for-auto-generating-scraping-code-for-my-css-plugin-exbrowser-too/

    • Like 2
  9. I am thoroughly confused and overwhelmed at this point, lol! Deliter you are great! But I am still quite far away from your skill and understanding. I need some time to try and understand this all, but I know it will help me in trying to finish this bot. Thank you!

    Just run the code above, and check the titles list in your debugger, no need to understand it really

     

    when you loaded you'l see an input for whatever youtube channel you want to scrape, it has yale loaded in there now

×
×
  • Create New...