Created
June 5, 2024 17:44
-
-
Save salif/7ba750c69d47a8a5a4434cfa0e47f45c to your computer and use it in GitHub Desktop.
bookmarklet to open video in new tab/downloading
This file contains 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
javascript:(function (w) {var vs = Array.from(w.document.body.querySelectorAll("video"));if (vs.length === 0) {w.document.querySelectorAll("iframe").forEach(vif => {vif.contentDocument?.body.querySelectorAll("video").forEach(vi => {vs.push(vi);});});};if (vs.length === 0) {w.alert("no videos!");} else {var v = vs.length === 1 ? vs[0]?.currentSrc : vs[w.Number.parseInt(w.prompt(vs.map((vv, ind) => ind + ": " + vv.currentSrc).join("\n"), "0"), 10)]?.currentSrc;if (v?.length > 0) { w.open(v, "_blank"); } else { w.alert("video src is empty!"); }};})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment