Skip to content

Instantly share code, notes, and snippets.

@tobias-khs
Last active August 25, 2022 06:43
Show Gist options
  • Select an option

  • Save tobias-khs/ba3819a761c905a58a74379f7f100fd4 to your computer and use it in GitHub Desktop.

Select an option

Save tobias-khs/ba3819a761c905a58a74379f7f100fd4 to your computer and use it in GitHub Desktop.
Bookmarklet to make the current YouTube video loop indefinitely. Also starts the video.
javascript:(function(){var duration=()=>{var dr=document.getElementsByClassName('ytp-time-duration')[0].textContent.split(':');var dur=parseInt(dr[0])*60+parseInt(dr[1]-2);return dur*1000};var ke=(keyCode)=>document.body.dispatchEvent(new KeyboardEvent('keydown',{bubbles:true,cancelable:true,keyCode}));var lop=()=>ke(48);setInterval(lop,duration());ke(32)})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment