This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
youtube_actions.js
61 lines (52 loc) · 1.66 KB
/
youtube_actions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function go_to_home()
{
document.querySelector('[title="YouTube Home"]').click();
}
/*
function go_to_yourchannel()
{
document.getElementById("avatar-btn").click();
document.getElementsByClassName("yt-simple-endpoint style-scope ytd-compact-link-renderer").click();
}
*/
function search_video(s)
{
//window.location.href = '/results?search_query=' + encodeURIComponent(s);
document.getElementById("search").querySelector("input").value = s;
document.getElementById("search-icon-legacy").click();
}
function ordinal_selection(num)
{
var video_list = document.getElementsByTagName("ytd-video-renderer");
var targetVid = video_list[num];
targetVid.querySelector("#thumbnail").click();
}
function like_video()
{
//var btn_list = document.getElementsByTagName("ytd-toggle-button-renderer");
var btns = document.getElementsByClassName("style-scope ytd-menu-renderer force-icon-button")
btns[0].click()
}
function dislike_video()
{
var btns = document.getElementsByClassName("style-scope ytd-menu-renderer force-icon-button")
btns[1].click()
}
function subscribe()
{
document.querySelector("#subscribe-button > ytd-subscribe-button-renderer > paper-button").click()
}
function unsubscribe()
{
document.querySelector("#subscribe-button > ytd-subscribe-button-renderer > paper-button").click()
setTimeout(document.querySelector("#button").click(),2000);
}
function click_subscriptions()
{
document.querySelector('[title="Subscriptions"]').click();
}
function open_settings()
{
//click settings
document.querySelector('[title="Settings"]').click();
}