Skip to content

Instantly share code, notes, and snippets.

@OutRite
Last active May 26, 2025 07:54
Show Gist options
  • Save OutRite/3c787305b7965f40579d3ab4def25178 to your computer and use it in GitHub Desktop.
Save OutRite/3c787305b7965f40579d3ab4def25178 to your computer and use it in GitHub Desktop.
YouTube Archive++
// ==UserScript==
// @name YouTube Archive++
// @namespace 534
// @match https://web.archive.org/web/*
// @grant none
// @version 1.3
// @author 534
// @description Improves Wayback Machine YouTube archives. View legacy CIDs, disable themeRefresh, and make das_captcha less annoying.
// @run-at document-body
// ==/UserScript==
// note: the run-at above is necessary for the themeRefresh disabler to work, no other value can reliably set the relevant experiment flag
document.addEventListener('DOMContentLoaded', function() { // We need to run this code once the DOM has finished loading, unlike the themeRefresh disabler
// das_captcha/terminated redirect
if (document.getElementsByClassName('impatient')[0]) { // This is the wayback machine's Redirecting... page.
var vqx = document.getElementsByClassName('impatient')[0].parentElement.children[5].innerText; // the url
console.log(vqx);
if (vqx.indexOf('das_captcha')>0 || vqx.indexOf('index?ytsession')>0 || vqx.indexOf('consent.youtube.com')>0) { // index?ytsession is for terminated channels, consent.youtube.com is for GDPR pages
var pn = window.location.pathname;
var dt = pn.split('/')[2]; // date in url
window.location.pathname = pn.replace(dt, '*'); // this changes the date to "*" which takes you to the generic wayback date picker page for the url
}}
// Legacy CID viewer
// This was the old CID system that utilized the same incremental 3DES system as video IDs, blog posts, and a few other parts of YT old and modern.
// Useful when trying to identify the exact registration ID number of a 2005 channel provided you have the CS ID list.
// 2009(?)-2011
if (document.getElementById('aProfileBlockUser')) {
var channel_id = document.getElementById('aProfileBlockUser').getAttribute('onclick').split("'")[1];
var built_html = `<div class="show_info outer-box-bg-as-border">
<div class="profile-info-label" style="float:left;font-weight:bold;">CID:</div>
<div class="profile-info-value" style="float:right;">${channel_id}</div>
<div class="cb"></div>
</div>`;
document.getElementsByClassName('profile_info')[0].insertAdjacentHTML('beforeend', built_html);
}
// 2007
var alinks = document.getElementsByTagName('a');
var addedid = false;
for (i=0;i<alinks.length;i++){
var clink = alinks[i];
if (!addedid && clink.getAttribute('href') && clink.getAttribute('href').split('friend_id=').length == 2) {
var channel_id = clink.getAttribute('href').split('friend_id=')[1];
var built_html = `<span class="smallText">CID:</span> <b>${channel_id}</b><br>`;
document.getElementsByClassName('padT8')[0].insertAdjacentHTML('beforeend', built_html);
addedid = true;
}
}
/*if (document.getElementById('aProfileAddFriend') && document.getElementById('aProfileAddFriend').getAttribute('href') && document.getElementById('aProfileAddFriend').getAttribute('href').split('friend_id=').length == 2) {
var channel_id = document.getElementById('aProfileAddFriend').getAttribute('href').split('friend_id=')[1];
var built_html = `<span class="smallText">CID:</span> <b>${channel_id}</b><br>`;
document.getElementsByClassName('padT8')[0].insertAdjacentHTML('beforeend', built_html);
}
if (document.getElementById('b4_i4') && document.getElementById('b4_i4').getAttribute('href').split('friend_id=').length == 2) {
var channel_id = document.getElementById('b4_i4').getAttribute('href').split('friend_id=')[1];
var built_html = `<span class="smallText">CID:</span> <b>${channel_id}</b><br>`;
document.getElementsByClassName('padT8')[0].insertAdjacentHTML('beforeend', built_html);
}*/
console.log("[YTA++] Stage 2 loaded, userscript is finished.")
}); // closes the settimeout from above
// Disable the themeRefresh redirect if your browser/system theme is set to dark (on modern archives)
try{
unsafeWindow.yt.config_.EXPERIMENT_FLAGS.kevlar_legacy_browsers = true;
} catch{}
console.log("[YTA++] Stage 1 loaded.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment