Auto likes a video near the end, the goal being to keep track of watched videos since youtube history is limited
< Valutazione su Youtube - Auto Like
I fixed an issue 2 weeks ago with version 0.8. I changed the selector for the video `document.querySelector('video.video-stream')`.
I fixed an issue 2 weeks ago with version 0.8. I changed the selector for the video `document.querySelector('video.video-stream')`.
If you want you can tell me how can i fix it by myself by changing a certain voice in the script
Are you using version 0.8 of the script `// @version 0.8`? Maybe it didn't auto update and you need to manually reinstall the script.
It works for me on Chrome. The like is triggered after watching 90% of the video `if(video.currentTime/video.duration > 0.9)`. Otherwise, I am not sure what could be the issue.
The script works by finding the video `let video = document.querySelector('video.video-stream')` and adding a listener `video.addEventListener('timeupdate'`. To find the like button, I use `document.querySelector('#segmented-like-button button')`. Maybe there is an issue with one of these query selectors.
Are you using version 0.8 of the script `// @version 0.8`? Maybe it didn't auto update and you need to manually reinstall the script.
It works for me on Chrome. The like is triggered after watching 90% of the video `if(video.currentTime/video.duration > 0.9)`. Otherwise, I am not sure what could be the issue.
The script works by finding the video `let video = document.querySelector('video.video-stream')` and adding a listener `video.addEventListener('timeupdate'`. To find the like button, I use `document.querySelector('#segmented-like-button button')`. Maybe there is an issue with one of these query selectors.
Yeah i updated it manually to the latest one but it doesn't work 😭
Oh that's weird. To confirm, do you wait until the end of the video for the like to trigger?
I just tested it on Firefox and it also works. I am using Tampermonkey but that shouldn't make a difference.
Do the query selectors (for video and like button) highlight the corresponding elements when typed in the console (see image)?
Does version 0.7 work? The findVideo is slighly more inefficient because it finds more than one video element.
function findVideo(onVideoFound){
let videos = [] // for some reason there is more than 1 video found
const observer = new MutationObserver((mutations, observer) => {
// Keep trying to find video
let video = document.querySelector('video')
if(video){
let alreadyFound = videos.includes(video)
if(!alreadyFound){
videos.push(video)
l('videos found:', videos)
onVideoFound(video)
}
}
})
observer.observe(document, {childList:true, subtree:true})
}
Does version 0.7 work? The findVideo is slighly more inefficient because it finds more than one video element.
function findVideo(onVideoFound){
let videos = [] // for some reason there is more than 1 video found
const observer = new MutationObserver((mutations, observer) => {
// Keep trying to find video
let video = document.querySelector('video')
if(video){
let alreadyFound = videos.includes(video)
if(!alreadyFound){
videos.push(video)
l('videos found:', videos)
onVideoFound(video)
}
}
})
observer.observe(document, {childList:true, subtree:true})
}
I just tried to install the 0.6 and it works 🤔😂 with the 0.7 doesn't work neither🤷🏻
Oh that's really strange. 0.7 should work if 0.6 works (the findVideo method is more general). Maybe Youtube is testing different layouts and we aren't receiving the same page.
Oh that's really strange. 0.7 should work if 0.6 works (the findVideo method is more general). Maybe Youtube is testing different layouts and we aren't receiving the same page.
Since 1 week it started to work randomly :( 3 times out of 10 it doesn't work anymore idk why.
It doesn't work anymore since 2 weeks :(
my pecs: chrome version 120.0.6099.35 and violentmonkey