Twitter Video Downloader

A lightweight client-side utility for grabbing direct video links from Twitter/X posts.

How to Use

  1. Drag the link below to your bookmarks bar OR copy the code and paste it into a new bookmark.
  2. Visit any page with an HTML5 video such as a Twitter/X post. YouTube will not work because videos are embedded in iframes and don't expose direct URLs. Anything that starts with blob: will also not work.
  3. Click the bookmark to open the video source in a new tab.

Drag this link to your bookmarks

🔗 Open Video Source

Bookmarklet Code

javascript: (function () {
  try {
    const videos = document.querySelectorAll("video");
    if (videos.length === 0) {
      alert("No <video> elements found on this page.");
      return;
    }
    let videoElement;
    if (videos.length === 1) {
      videoElement = videos[0];
    } else {
      let list = "";
      videos.forEach((vid, i) => {
        const src =
          vid.currentSrc ||
          vid.querySelector("source")?.src ||
          vid.src ||
          "[no source]";
        const displaySrc = src.length > 60 ? src.slice(0, 57) + "..." : src;
        list += `${i}: ${displaySrc}\n`;
      });
      const input = prompt(`Multiple videos found. Enter a number:\n\n${list}`);
      if (input === null) return;
      const index = parseInt(input.trim(), 10);
      if (isNaN(index) || index < 0 || index >= videos.length) {
        alert("Invalid selection.");
        return;
      }
      videoElement = videos[index];
    }
    const source =
      videoElement.currentSrc ||
      videoElement.querySelector("source")?.src ||
      videoElement.src;
    if (source) {
      window.open(source, "_blank");
    } else {
      alert("Video found, but no source URL is available.");
    }
  } catch (e) {
    alert("An error occurred: " + e.message);
  }
})();

All work and no play makes jack a dull boy.