Youtube searching

cioineago0

New Member
Premium
Joined
Jan 21, 2020
Messages
1
Reaction score
0
Achievement
i found this macro script for youtube searching

<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++;
}

I want to modify this script to click a video with this name
Never Miss a Beat | Kaiser Permanente

for example ,
can someone help me ?
 

saadfarah12

New Member
Premium
Joined
Jan 17, 2020
Messages
5
Reaction score
0
Achievement
hi
can any one help me i whant script for short.st
pleas
:eek:
 

owelko

Active Member
Premium
Joined
Oct 18, 2019
Messages
103
Reaction score
28
Location
Always on Discord
Website
bit.ly
Achievement
line 8 change to your desired keywords
var randomKeyword = RandomArray(["keyword 1", "keyword 2"]);
line 18 your ranking keyword
& title in the green highlighted
var myTarget = GenerateXpath("a", "title", "%keyword%"); //change "keyword" to your own keyword
 

daxdasun

New Member
VIP
Joined
Nov 4, 2021
Messages
3
Reaction score
0
Achievement
This code has a syntax error. Please help me

<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++;
}
 

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