Jump to content
UBot Underground

Recommended Posts

Ubotting Buddies,

 

 

Are you experiencing any scraping problem with Ubot 5 ? 

 

Try getting Ubot to scrape data from the Ubot Video found on youtube:


 


To me it seems it fails to scrape the:

 

Channel Subscribers Number

Thumbs Up Number

Thumbs Down Number


 

You will see that, no matter what attribute Ubot suggests for you to use (for it being unique on the page) to identify or select the item, if you use the suggested then it fails to scrape. Try the class and outerhtml attributes afterwards one after the other to identify the items and you will see still no luck. I try scraping innertext to scrape the numbers.

 

If you have any luck then let me know!

 

Cheers!

Edited by bangali_beta
Link to post
Share on other sites

Here the code:

 

 View Videos()
define View Videos {
    divider
    set(#videos comment,$replace(#videos comment,"<KEYWORDS>",#keywords),"Global")
    set(#videos comment,$replace(#videos comment,"<PROMOTIONAL URL>",#promotional url),"Global")
    divider
    set(#current position on list_sers or videos,0,"Global")
    clear list(%channels subscribers numbers)
    clear list(%videos views numbers)
    clear list(%videos likes numbers)
    clear list(%videos dislikes numbers)
    navigate("https://www.youtube.com/watch?v=xJJ8qgK9Kvo","Wait")
    wait for element(<outerhtml=w"<span class=\"yt-subscription-button-subscriber-count-*">,"","Appear")
    wait for element(<class="watch-view-count">,"","Appear")
    wait for element(<title="I like this">,"","Appear")
    wait for element(<title="I dislike this">,"","Appear")
    set(#current video channel subscribers number,$nothing,"Global")
    if($exists(<outerhtml=w"<outerhtml=w\"<span class=\\\"yt-subscription-button-subscriber-count-branded-horizontal yt-short-subscriber-count\\\" title=\\\"*\\\" aria-label=\\\"*\\\" tabindex=\\\"0\\\">*</span>\">">)) {
        then {
            set(#current video channel subscribers number,$scrape attribute(<outerhtml=w"<outerhtml=w\"<span class=\\\"yt-subscription-button-subscriber-count-branded-horizontal yt-short-subscriber-count\\\" title=\\\"*\\\" aria-label=\\\"*\\\" tabindex=\\\"0\\\">*</span>\">">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video channel subscribers number,"N/A","Global")
            divider
        }
    }
    add item to list(%channels subscribers numbers,#current video channel subscribers number,"Don\'t Delete","Global")
    divider
    set(#current video views number,$nothing,"Global")
    if($exists(<outerhtml=w"<div class=\"watch-view-count\">*views</div>">)) {
        then {
            set(#current video views number,$scrape attribute(<outerhtml=w"<div class=\"watch-view-count\">*views</div>">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video views number,"N/A","Global")
            divider
        }
    }
    add item to list(%videos views numbers,#current video views number,"Don\'t Delete","Global")
    divider
    set(#current video likes,$nothing,"Global")
    if($exists(<title="I like this">)) {
        then {
            set(#current video likes,$scrape attribute(<outerhtml=w"<button class=\"yt-uix-button yt-uix-button-size-default yt-uix-button-opacity yt-uix-button-has-icon no-icon-markup like-button-renderer-like-button like-button-renderer-like-button-unclicked  yt-uix-post-anchor yt-uix-tooltip\" type=\"button\" onclick=\";return false;\" aria-label=\"*\" title=\"I like this\" data-orientation=\"vertical\" data-post-action=\"/service_ajax\" data-force-position=\"true\" data-post-data=\"se=*\" data-position=\"bottomright\" data-tooltip-text=\"I like this\" *</button>">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video likes,"N/A","Global")
            divider
        }
    }
    add item to list(%videos likes numbers,#current video likes,"Don\'t Delete","Global")
    divider
    set(#current video dislikes,$nothing,"Global")
    if($exists(<title="I dislike this">)) {
        then {
            set(#current video dislikes,$scrape attribute(<outerhtml=w"<button class=\"yt-uix-button yt-uix-button-size-default yt-uix-button-opacity yt-uix-button-has-icon no-icon-markup like-button-renderer-dislike-button like-button-renderer-dislike-button-unclicked  yt-uix-post-anchor yt-uix-tooltip\" type=\"button\" onclick=\";return false;\" aria-label=\"*\" title=\"I dislike this\" data-orientation=\"vertical\" data-post-action=\"/service_ajax\" data-force-position=\"true\" data-post-data=\"se=*\" data-position=\"bottomright\">*</button>">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video dislikes,"N/A","Global")
            divider
        }
    }
    add item to list(%videos dislikes numbers,#current video dislikes,"Don\'t Delete","Global")
    divider
}

Link to post
Share on other sites

Issue nearly solved.

In short, Ubot suggests I use the class and title attributes to identify the video views, video likes and video unlikes numbers (data) but when you do that then it fails to find them on the page and so fails to scrape them.

 

This time I ignored it's suggestion and used offsets instead that it started suggesting now. Working code:

 

 

 View Videos()
define View Videos {
    divider
    set(#videos comment,$replace(#videos comment,"<KEYWORDS>",#keywords),"Global")
    set(#videos comment,$replace(#videos comment,"<PROMOTIONAL URL>",#promotional url),"Global")
    divider
    set(#current position on list_sers or videos,0,"Global")
    clear list(%channels subscribers numbers)
    clear list(%videos views numbers)
    clear list(%videos likes numbers)
    clear list(%videos dislikes numbers)
    navigate("https://www.youtube.com/watch?v=xJJ8qgK9Kvo","Wait")
    wait for element(<class="yt-subscription-button-subscriber-count-branded-horizontal yt-short-subscriber-count">,"","Appear")
    wait for element(<class="watch-view-count">,"","Appear")
    wait for element($element offset(<class="yt-uix-button-content">,14),"","Appear")
    wait for element($element offset(<class="yt-uix-button-content">,17),"","Appear")
    set(#current video channel subscribers number,$nothing,"Global")
    if($exists(<class="yt-subscription-button-subscriber-count-branded-horizontal yt-short-subscriber-count">)) {
        then {
            set(#current video channel subscribers number,$scrape attribute(<class="yt-subscription-button-subscriber-count-branded-horizontal yt-short-subscriber-count">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video channel subscribers number,"N/A","Global")
            divider
        }
    }
    add item to list(%channels subscribers numbers,#current video channel subscribers number,"Don\'t Delete","Global")
    divider
    set(#current video views number,$nothing,"Global")
    if($exists(<outerhtml=w"<div class=\"watch-view-count\">*views</div>">)) {
        then {
            set(#current video views number,$scrape attribute(<outerhtml=w"<div class=\"watch-view-count\">*views</div>">,"innertext"),"Global")
            divider
        }
        else {
            set(#current video views number,"N/A","Global")
            divider
        }
    }
    add item to list(%videos views numbers,#current video views number,"Don\'t Delete","Global")
    divider
    set(#current video likes,$nothing,"Global")
    if($exists($element offset(<class="yt-uix-button-content">,14))) {
        then {
            set(#current video likes,$scrape attribute($element offset(<class="yt-uix-button-content">,14),"innertext"),"Global")
            divider
        }
        else {
            set(#current video likes,"N/A","Global")
            divider
        }
    }
    add item to list(%videos likes numbers,#current video likes,"Don\'t Delete","Global")
    divider
    set(#current video dislikes,$nothing,"Global")
    if($exists($element offset(<class="yt-uix-button-content">,17))) {
        then {
            set(#current video dislikes,$scrape attribute($element offset(<class="yt-uix-button-content">,17),"innertext"),"Global")
            divider
        }
        else {
            set(#current video dislikes,"N/A","Global")
            divider
        }
    }
    add item to list(%videos dislikes numbers,#current video dislikes,"Don\'t Delete","Global")
    divider
}

Edited by bangali_beta
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...