Last active
December 14, 2021 14:21
Revisions
-
AsP3X revised this gist
Dec 14, 2021 . 1 changed file with 41 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,57 @@ var clearTimer; function clearWatchList(interval) {clearTimer = setInterval(clearWatchLater, interval);} function getButtonAttr() { var menuName = ["Aktionsmenü", "Action menu"] var buttons = document.querySelectorAll("#button"); for (var i = 0; i < buttons.length; i++) { var context = buttons[i].getAttribute("aria-label"); if (menuName.includes(context)) return buttons[i].getAttribute("aria-label"); } } function getPlaylistName() { var playlistElem_watchLater = document.querySelectorAll("#title > yt-formatted-string > a")[0].innerHTML; var playlistElem = document.getElementById("text-displayed"); if (playlistElem) { return playlistElem.innerHTML; } else { return playlistElem_watchLater; } } function getVideoCount() { var elem = document.querySelectorAll("#stats > yt-formatted-string:nth-child(1) > span:nth-child(1)"); if (!elem) return 0; var count = elem[0].innerHTML; return ((count - 1)); } function evaluate(playlistName) { return document.evaluate(`//span[contains(text(),"${playlistName}")]`,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); } function killSwitch() { clearInterval(clearTimer); } function clearWatchLater() { var selectorLabel = getButtonAttr(); var playlistName = getPlaylistName(); var videos = getVideoCount(); document.querySelector(`#primary button[aria-label="${selectorLabel}"]`).click(); var things = evaluate(playlistName); for (var i = 0; i < videos; i++) { things.snapshotItem(i).click(); if (i == videos) { killSwitch(); } console.log(getVideoCount()); } } -
AsP3X revised this gist
Dec 14, 2021 . 1 changed file with 15 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,21 @@ var clearTimer; function clearWatchList(interval) {clearTimer = setInterval(clearWatchLater, interval);} function getButtonAttr() { var elemArray = document.querySelectorAll("#button"); return elemArray[37].getAttribute("aria-label"); } function getPlaylistName() { var playlistElem = document.getElementById("text-displayed"); return playlistElem.innerHTML; } function clearWatchLater(buttonName, fieldName) { var selectorLabel = getButtonAttr(); var playlistName = getPlaylistName(); document.querySelector(`#primary button[aria-label="${selectorLabel}"]`).click(); var things = document.evaluate(`//span[contains(text(),"${playlistName}")]`,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); if (things.snapshotLength = 0) {killSwitch()} for (var i = 0; i < things.snapshotLength; i++) { things.snapshotItem(i).click(); -
AsP3X created this gist
Dec 13, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ var clearTimer; function clearWatchList(interval) {clearTimer = setInterval(clearWatchLater, interval);} function clearWatchLater(buttonName, fieldName) { document.querySelector('#primary button[aria-label="Aktionsmenü"]').click(); var things = document.evaluate('//span[contains(text(),"Später ansehen")]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); if (things.snapshotLength = 0) {killSwitch()} for (var i = 0; i < things.snapshotLength; i++) { things.snapshotItem(i).click(); } } function killSwitch() { clearInterval(clearTimer); }