Skip to content

Instantly share code, notes, and snippets.

@danthemango
Created February 15, 2022 23:00
Show Gist options
  • Save danthemango/03f11546fc4082446ab55a7a27853d63 to your computer and use it in GitHub Desktop.
Save danthemango/03f11546fc4082446ab55a7a27853d63 to your computer and use it in GitHub Desktop.
quick javascript function to fetch youtube timestamp from livestream, for pasting into devtools
(function getURLTime() {
const params = (new URL(document.location)).searchParams
if(params.has('v')) {
const v = params.get('v');
const ytplayer = document.getElementById("movie_player");
const t = Math.round(ytplayer.getCurrentTime())
const newUrl = `https://youtu.be/${v}?t=${t}`;
return newUrl;
}
return document.location;
})()
@danthemango
Copy link
Author

Prepend with "javascript:" in the URL section of a chrome bookmark. This script allows me to fetch the current timestamp of a youtube livestream while it is broadcasting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment