Skip to content

Instantly share code, notes, and snippets.

@rebane2001
Created September 26, 2022 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rebane2001/a69e5a569a76f49c262e6732f14226f2 to your computer and use it in GitHub Desktop.
Save rebane2001/a69e5a569a76f49c262e6732f14226f2 to your computer and use it in GitHub Desktop.
Old version, still works but has some glitches
// ==UserScript==
// @name Search Hobune for all videos on page
// @namespace hobune.stream
// @match https://www.youtube.com/*
// @grant GM_xmlhttpRequest
// @connect hobune.stream
// @version 1.0
// @author Rebane
// @description 1/8/2021, 12:02:22 PM
// ==/UserScript==
let hobuneEndpoint = "https://hobune.stream/tpa-h/videos/";
function checkVideo(vidID){
GM_xmlhttpRequest ( {
method: 'GET',
url: hobuneEndpoint + vidID,
onload: function (vidID) {
return (response) => {
let obj = document.getElementsByClassName("timecode-" + vidID)[0];
obj.innerText = (response.status == 200 ? "✔️ " : "❌ " ) + obj.innerText;
}
}(vidID)
} );
}
function checkAllVideos(){
setTimeout(() => {
document.querySelectorAll("span.ytd-thumbnail-overlay-time-status-renderer").forEach(obj => {
let vidID = obj.parentElement.parentElement.parentElement.href.split("=")[1];
vidID = vidID.replace("&t", "").replace(/[^a-zA-Z0-9_-]/g, "");
obj.classList.add("timecode-" + vidID);
checkVideo(vidID);
});
}, 5000);
}
checkAllVideos();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment