Youtube polymer engine fixes

Some fixes for Youtube polymer engine

< Feedback on Youtube polymer engine fixes

Review: OK - script works, but has bugs

§
Posted: 19-10-2023

I'm a YouTube user, and I find it inconvenient to click 'Show more replies' repeatedly to view all comments on videos. It can be quite tedious to repeatedly click "Show more replies" to see all the comments on a video. This process is time-consuming and can be frustrating, affecting the overall viewing experience. Could you please tell me a way so that I can load all comments at once? It would make my YouTube experience much better.

BogudanTác giả
§
Posted: 19-10-2023

Sorry, I don't know any way to do it.

§
Posted: 25-10-2023

try for firefox in a greasmonkey or tampermonkey script area
Not sure if the see more or more option works for each comment i couldnt be bothered with the stupid ai.r

// ==UserScript==
// @name YouTube Comments Expand All Replies
// @namespace http://tampermonkey.net/
// @version 1
// @description Expand all replies and "Show more replies" buttons on YouTube comments section
// @author Your Name
// @match https://www.youtube.com/watch*
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
'use strict';

// Keep track of comment threads that have been processed
var processedThreads = new Set();

// Function to expand replies and "Read more" buttons
function expandReplies() {
// Get all comment threads
var commentThreads = document.querySelectorAll('ytd-comment-thread-renderer');

// Loop through each comment thread
for (var i = 0; i < commentThreads.length; i++) {
// Check if the thread has already been processed
if (processedThreads.has(commentThreads[i])) {
continue;
}

// Get the "Replies" button
var repliesButton = commentThreads[i].querySelector('button[aria-label*="repl"]');

// If the button exists, click it
if (repliesButton) {
repliesButton.click();
}

// Get the "Show more replies" button
var showMoreRepliesButton = commentThreads[i].querySelector('button[aria-label^="Show more replies"]');

// If the button exists, click it
if (showMoreRepliesButton) {
showMoreRepliesButton.click();
}

// Get the "Read more" button
var readMoreButton = commentThreads[i].querySelector('tp-yt-paper-button#more');

// If the button exists, click it
if (readMoreButton) {
readMoreButton.click();
}

// Add the thread to the processed set
processedThreads.add(commentThreads[i]);
}
}

// Call the expandReplies function every 500 milliseconds
setInterval(expandReplies, 500);
})();


btw this is a email used by people who dont want to use there real email to sign in so dont expect to see me but i will keep an eye on this i personally dont like writing things but i do know enough about css html and javascript to be able to hit the ai on the back of the head to make it do what im after and when in doubt i go to the javascript books online and look for a code piece im after and then tell chat gpt to use it with x script and there you go basically im not sure about the more part on youtube those guys are getting smart alekie with buttons and stuff lately eg more for the comments is a 4 liner one to say here is the comment and 3 or 4 extra lines and then under it more / less codes that you click to make it work and scripts the usual .click() to select either one to show more or less and the text is not working for me at the moment could be i need to redo the script it may not work at all i know chrome and firefox can be different but i think this script should work its not hard to do its 5 minutes if you get an ai that listens to what you say to do on looping and checking and other various things eg this script will work and check to see if the entire tags are all done i think it works fine might miss the first tag im not sure depends on a few things.

§
Posted: 25-10-2023
Edited: 25-10-2023

havent got a tampermonkey or greasemonkey just copy from the function down to the last ; then past it into a page with comments up. Press shift ctrl and I and put it in the console part to execute the code it may work after that group are done or it might literally find all of them and work perfectly its code it sometimes works well othertimes meh and firefox chrome it depends on the code of the day by youtube.com but i think this should work for you it is annoying i do accept that myself I personally use the youtube addon on firefox it is on chrome as well its tweaks for youtube and if you do find my code works for you in your browser a plus of tweaks for youtube.com is that it has an area that you can place code into so it can insert it into youtube page for you so a plus i have my own code in there to stop the BEEPING FULLSCREEN ON YOUTUBE FROM SCROLLING DOWN SO FING ANNOYING


YEAH IF YOU LIKE Tweaks for youtube my fullscreen stopper script is below it works like a dream it takes the f key it detects the fullscreen button and it no i forgot to add the f12 button to it oh well i never use fullscreen with the function buttons but all the rest are in there oh btw the code i have in this chat i dont care people can use it for profit if they want its barely worth anything but incase someone was wondering. anyway this script removes the element on a tag that keeps the screen moving down i cant remember what it was as the script works perfectly to this very day so happy with it OH YEAH IT ALSO DETECTS DOUBLE CLICK ON THE VIDEO ELEMENT TO REMOVE THE ELEMENT THAT ALLOWS SCROLLING IN FULL SCREEN ITS ALMOST A DONE EVERYTHING AT ONCE PIECE OF CODE SO I NEVER HAVE TO DEAL WITH A FULLSCREEN SCROLLING DOWN AGAIN
Oh and if you cant tell
the script does QUITE a few checks here there and everywhere as well as certain things like the f key and double clicking the video tag or fullscreen on the player etc so it should be reasonable at detecting and removing the scrolling part of the tag that allows fullscreen scrolling

(function(RemoveFullScreenYTDAPPSCROLLINGElement) {
'use strict';

function removeScrollingAttribute() {
var ytdApp = document.querySelector('ytd-app');
if (ytdApp && ytdApp.hasAttribute('scrolling')) {
ytdApp.removeAttribute('scrolling');
}
}

function checkForScrollingAttribute() {
var ytdApp = document.querySelector('ytd-app');
if (ytdApp && ytdApp.hasAttribute('scrolling')) {
setTimeout(removeScrollingAttribute, 10);
setTimeout(checkForScrollingAttribute, 1000);
} else {
setTimeout(checkForScrollingAttribute, 1000);
}
}

function removeScrollingBeforeFullscreen() {
var ytdApp = document.querySelector('ytd-app');
if (ytdApp && ytdApp.hasAttribute('scrolling')) {
ytdApp.removeAttribute('scrolling');
}
}

function handleDoubleClick(event) {
// Check if the target element is the video element
if (event.target.tagName === 'VIDEO') {
removeScrollingBeforeFullscreen();
}
}

function handleKeyPress(event) {
// Check if the key is the 'f' key and is pressed outside of an input or search box
if (event.key === 'f' && event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {
removeScrollingBeforeFullscreen();
}
}

var fullscreenButton = document.querySelector('.ytp-fullscreen-button');
if (fullscreenButton) {
fullscreenButton.addEventListener('click', removeScrollingBeforeFullscreen);
}

document.addEventListener('fullscreenchange', function() {
if (document.fullscreenElement) {
checkForScrollingAttribute();
}
});

document.addEventListener('dblclick', handleDoubleClick);
document.addEventListener('keypress', handleKeyPress);
})();

§
Posted: 25-10-2023

btw i know its junk code it could be cleaned up quite a lot but hey any GOOD coders out there probably have things to do lol..... chat ais are okay but they tend to loose their mind too quick in a non logged in mode so it pays to put things in and hope the above cod works never had a problem with it but i recommend running it through someone else / chat ai then see if it works good for you

Post reply

Đăng nhập để bình luận