Greasy Fork is available in English.
Fix Youtube video's publishing date
< Feedback on Youtube Videos Publishing Date
I checked how the popular Chrome extension does this. they do a request to the youtube API, in case someone want to improve on it:
function getRemoteUploadDate(e, t) { fetch("https://www.youtube.com/youtubei/v1/player?prettyPrint=false", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ context: { client: { clientName: "WEB", clientVersion: "2.20240416.01.00" }, }, videoId: e, }), }) .then((e) => { if (e.ok) return e.json(); throw new Error("Network response was not ok"); }) .then((e) => { e = e.microformat.playerMicroformatRenderer; e.liveBroadcastDetails?.startTimestamp ? t(e.liveBroadcastDetails.startTimestamp) : e.publishDate ? t(e.publishDate) : t(e.uploadDate); }) .catch((e) => { console.error( "[SYVUD]", "There was a problem with the fetch operation:", e ); }); }
how to test it:
getRemoteUploadDate("video id", console.log)
Sign in to post a reply.
I checked how the popular Chrome extension does this. they do a request to the youtube API, in case someone want to improve on it:
how to test it:
getRemoteUploadDate("video id", console.log)