Created
October 30, 2025 16:36
-
-
Save jejkukany/4d57227c5b85d0dee92fbff47c0627f8 to your computer and use it in GitHub Desktop.
Updates URL to current Youtube timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name YouTube URL Timestamp Updater | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-10-30 | |
| // @description Updates the URL with the current video time without creating duplicates. | |
| // @author You | |
| // @match https://www.youtube.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com | |
| // @grant none | |
| // @author Daniel Young | |
| // ==/UserScript== | |
| (function () { | |
| "use strict"; | |
| setInterval(function () { | |
| const player = document.querySelector("#movie_player"); | |
| if (player && typeof player.getCurrentTime === "function") { | |
| const currentTime = Math.floor(player.getCurrentTime()); | |
| const url = new URL(window.location.href); | |
| url.searchParams.set("t", currentTime + "s"); | |
| if (window.location.href !== url.href) { | |
| window.history.pushState({}, "", url.href); | |
| } | |
| } | |
| }, 2500); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment