Skip to content

Instantly share code, notes, and snippets.

@vsubhash
Last active September 10, 2018 06:39
Show Gist options
  • Save vsubhash/beef2a836f11fa207718ba72fcb0510a to your computer and use it in GitHub Desktop.
Save vsubhash/beef2a836f11fa207718ba72fcb0510a to your computer and use it in GitHub Desktop.
YouTube LoadMore Till No More (com.vsubhash.js.bypass-phone-number-prompt) is a User Script for YouTube that will automatically expand the video listing pages until the last video is found. It repeatedly clicks the Load More button to ensure that all videos are automatically listed. This script can be installed in Firfox browsers using the Greas…
// ==UserScript==
// @name YouTube LoadMore Till No More
// @namespace com.vsubhash.js.youtube-load-more-till-no-more
// @description Automatically expands the videoslist
// @include /https://www\.youtube\.com/(channel|user)/(\w+)/videos*/
// @exclude %exclude%
// @version 2018
// @grant none
// ==/UserScript==
var iYLM_Timeout = 0;
var iCounter = 0;
document.addEventListener("DOMContentLoaded", startItDelayed, false);
function startItDelayed() {
iYLM_Timeout = window.setTimeout(loadMore, 10*1000);
}
function loadMore() {
console.log("YLM: We are in");
if (document.getElementsByClassName("load-more-button").length > 0) {
if (document.getElementsByClassName("load-more-button")[0].getElementsByClassName("load-more-text").length > 0) {
document.getElementsByClassName("load-more-button")[0].getElementsByClassName("load-more-text")[0].click();
console.log("YLM: Loading more " + (++iCounter));
startItDelayed();
}
} else if (iYLM_Timeout != 0) {
console.log("YLM: No more found ");
window.clearTimeout(iYLM_Timeout);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment