Searching video on Youtube !

daniel

Administrator
Staff member
VIP
Joined
Feb 23, 2018
Messages
268
Reaction score
36
Achievement
Hi, this is script for searching video on youtube with a random keyword from 2 keywords ("bypass captcha 9hits" and "google search 9hits"). Then click to the video if found in the search result.
Finally, while viewing the video, the script will click to the playing time bar for 2 times.

You are able to modify this script to fit your need, as well as make it more flexible, more real. Or you can also as help from us to create your own script.

https://youtu.be/mT6NSk1M3E4
Code:
//Wait for page load
await Delay(1000);
while(await IsLoading()) await Delay(1000);

//typing a random keyword and hit enter (13 is key code of Enter key)
var randomKeyword = RandomArray(["bypass captcha 9hits", "google search 9hits"]);
await Delay(1000);
Typing(randomKeyword);
await Delay(1000);
SendKeyPress(13);

//delay for a while when we just press Enter.
await Delay(5000);

//check for our target if found or not. I would like to click to any video has title contain 9Hits
var myTarget = GenerateXpath("a", "text", "%9Hit%");
var found = false;

var pageCount = 0;
while(!found)
{
    found = await GetAttribute(myTarget, "href");
    
    //if found the target, do click it
    if(found){
        ClickByXpath(myTarget);
        await Delay(5000); //wait for the video load
        
        //click to the time playing process
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
        
        //click to the time playing process one more time
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
        
        // do more interaction....
        //.....
        //----------
        
        break;
    }
    
    //if not found, scroll down to laod more result, and check again
    SendMouseWheel(0, -10000);
    await Delay(3000);
    
    //suppose we only scroll down for 5 times.
    if(pageCount > 5) break;
    pageCount++;
}
 

BarryGreep

New Member
Joined
Jun 29, 2019
Messages
10
Reaction score
0
Age
42
Location
United Kingdom
Website
www.nacdd1305.org
Searching video on Youtube

<t>I have been searching for a video of a cammed 4.0 mustang, ranger, explorer, i am not too consirened over which vehicle it is, i just am looking to a. see what a cammed 4.0 sohc sounds like, and B. see how well it runs. If anyone has any good videos and is kind enough to post them here it would be greatly appriciated.</t>
 

Wissmo

New Member
Premium
Joined
Aug 29, 2019
Messages
2
Reaction score
0
Achievement
The code from above has not worked for me. Just made a few changes
Code:
<i>
</i>//waits for page to load
await Delay(1000);
while(await IsLoading()) await Delay(1000);

//types the keyword and hit enter (13 is key code of Enter key)
await ClickByXpath(GenerateXpath("input", "type", "text"));
var randomKeyword = RandomArray(["keyword 1", "keyword 2"]);
await Delay(1000);
Typing(randomKeyword);
await Delay(2000);
SendKeyPress(13);

//just waits 5 seconds after search
await Delay(5000);

//checks for the target if its there. If yes, its clicks on any video that contains your keyword in the title
var myTarget = GenerateXpath("a", "title", "%keyword%"); //change "keyword" to your own keyword
var found = false;

var pageCount = 0;
while(!found)
{
    found = await GetAttribute(myTarget, "href");
    
    //if found the target, do click it
    if(found){
        ClickByXpath(myTarget);
        await Delay(5000); //wait for the video to load
        
        //clicks randomly in the progress bar
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
        
        //clicks randomly in the progress bar one more time
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
        
        //opens the show more in the discription
        await Delay(Random(5000, 10000));
        ClickByClass("more-button style-scope ytd-video-secondary-info-renderer");
        
        //scrolls down to the comments
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, -10000);
        
        //scrolls down to the comments
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, -10000);
        
        //scrolls back up to the video
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, 20000);
        
        break;
    }
    
    //if not found, scrolls down to laod more result, and check again
    SendMouseWheel(0, -10000);
    await Delay(3000);
    
    //only scrolls down for 5 times.
    if(pageCount > 5) break;
    pageCount++;
}
 

cucaibap

New Member
Premium
Joined
Feb 1, 2020
Messages
13
Reaction score
0
Achievement
The code from above has not worked for me. Just made a few changes
Code:
<i>
</i>//waits for page to load
await Delay(1000);
while(await IsLoading()) await Delay(1000);

//types the keyword and hit enter (13 is key code of Enter key)
await ClickByXpath(GenerateXpath("input", "type", "text"));
var randomKeyword = RandomArray(["keyword 1", "keyword 2"]);
await Delay(1000);
Typing(randomKeyword);
await Delay(2000);
SendKeyPress(13);

//just waits 5 seconds after search
await Delay(5000);

//checks for the target if its there. If yes, its clicks on any video that contains your keyword in the title
var myTarget = GenerateXpath("a", "title", "%keyword%"); //change "keyword" to your own keyword
var found = false;

var pageCount = 0;
while(!found)
{
    found = await GetAttribute(myTarget, "href");
   
    //if found the target, do click it
    if(found){
        ClickByXpath(myTarget);
        await Delay(5000); //wait for the video to load
       
        //clicks randomly in the progress bar
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
       
        //clicks randomly in the progress bar one more time
        await Delay(Random(5000, 10000));
        ClickByClass("ytp-load-progress");
       
        //opens the show more in the discription
        await Delay(Random(5000, 10000));
        ClickByClass("more-button style-scope ytd-video-secondary-info-renderer");
       
        //scrolls down to the comments
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, -10000);
       
        //scrolls down to the comments
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, -10000);
       
        //scrolls back up to the video
        await Delay(Random(2000, 5000));
        SendMouseWheel(0, 20000);
       
        break;
    }
   
    //if not found, scrolls down to laod more result, and check again
    SendMouseWheel(0, -10000);
    await Delay(3000);
   
    //only scrolls down for 5 times.
    if(pageCount > 5) break;
    pageCount++;
}
var myTarget = GenerateXpath("a", "title", "%keyword%"); //change "keyword" to your own keyword
i want click keyword 1 or 2 . how change keyword?
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu