Jump to content
UBot Underground

Why is my code freezing the bot


Recommended Posts

Hello,

 

I am working on writing a bot that will allow the user to gather Youtube videos to a list for posting on their WordPress website.

 

My problem, is that this code:

loop while($comparison(#stop, "!=", "Stop")) {
    set(#add_all_videos, "false", "Global")
    set(#add_video, "false", "Global")
    if($comparison(#add_all_videos, "=", "add")) {
        then {
            add list to list(%vid_urls, $scrape attribute(<class="contains-addto yt-uix-sessionlink     spf-link ">, "fullhref"), "Delete", "Global")
        }
        else {
        }
    }
    if($comparison(#add_video, "=", "add")) {
        then {
            add item to list(%vid_titles, $scrape attribute(<id="eow-title">, "innertext"), "Delete", "Global")
            wait(3)
            click(<class="yt-uix-button yt-uix-button-size-default yt-uix-button-expander yt-uix-expander-head yt-uix-expander-collapsed-body yt-uix-gen204">, "Left Click", "No")
            wait(3)
            add item to list(%vid_description, $scrape attribute(<(tagname="p" AND id="eow-description")>, "innertext"), "Delete", "Global")
        }
        else {
        }
    }
    increment(#position)
}

The code above is causing my ubot studio to freeze. Below is the full code for my bot:

ui save file("Where to save video data", #save_vid)
ui stat monitor("Number of Youtube URLs:", $list total(%vid_urls))
ui stat monitor("Number of titles scrapped:", $list total(%vid_titles))
ui stat monitor("Number of  desc scrapped:", $list total(%vid_description))
set(#position, 0, "Global")
ui button("Add this video") {
    set(#add_video, "add", "Global")
}
ui button("Add all videos") {
    set(#add_all_videos, "add", "Global")
}
ui button("Done adding") {
    set(#stop, "Stop", "Global")
}
set(#stop, "Go", "Global")
loop while($comparison(#stop, "!=", "Stop")) {
    set(#add_all_videos, "false", "Global")
    set(#add_video, "false", "Global")
    if($comparison(#add_all_videos, "=", "add")) {
        then {
            add list to list(%vid_urls, $scrape attribute(<class="contains-addto yt-uix-sessionlink     spf-link ">, "fullhref"), "Delete", "Global")
        }
        else {
        }
    }
    if($comparison(#add_video, "=", "add")) {
        then {
            add item to list(%vid_titles, $scrape attribute(<id="eow-title">, "innertext"), "Delete", "Global")
            wait(3)
            click(<class="yt-uix-button yt-uix-button-size-default yt-uix-button-expander yt-uix-expander-head yt-uix-expander-collapsed-body yt-uix-gen204">, "Left Click", "No")
            wait(3)
            add item to list(%vid_description, $scrape attribute(<(tagname="p" AND id="eow-description")>, "innertext"), "Delete", "Global")
        }
        else {
        }
    }
    increment(#position)
}
wait(3)
add list to table as column(&video_data, 0, 0, %vid_titles)
add list to table as column(&video_data, 0, 1, %vid_description)
add list to table as column(&video_data, 0, 2, %vid_category)
add list to table as column(&video_data, 0, 3, %vid_urls)
wait(3)
save to file(#save_vid, &video_data)
clear list(%vid_urls)

Any idea what I am doing wrong here?

Edited by askwpcoach
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...