- 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 ?
<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 ?