New Tampermonkey script: YouTube ID's to Clipboard

  • YT-URL-Extractor

What is this thing?

YT-URL-Extractor is a Tampermonkey (and other *monkey) script to extract YT ID(s) from most YT pages with a single click. I wanted an easy one click solution to grab every YouTube ID from a page, then give me a neat list without duplicates ready for use elsewhere. I also fancied brushing up on my Tampermonkey/Javascript skills so though I would give it a go. I set to work throwing a solution together and ended up with this, it's a fairly neat solution that adds a discrete 📋 button at the top of most pages, clicking it will either copy the current URL if you are watching a video or short, or on a playlist style page you'll get every a list of every URL on the page.


  • Quick and easy to use
  • Should work with most *monkey variants: Tested/Developed with Chrome Tampermonkey v4.18.1, Also tested on Firefox Greasemonkey 4.11 (from 2021)
  • Auto updates if your *monkey variant supports it

Sounds great, how do I use it?

  • The easiest way to install this is to click this link:
    YT-URL-Extractor.user.js most *monkey's auto install features will then take care of things, this also can be used to manually trigger an update.
  • OR, view the YT-URL-Extractor.user.js and then click the RAW button, if you wish to check out the code first.
  • OR, Download or Copy/Paste the YT-URL-Extractor.user.js into your *monkey, save and activate.

Next time you vist a supported page (you may need to refresh if you are already on a YT page) you will see a small clipboard icon 📋 next to the mic icon at the top of the page.

New clipboard icon next to mic icon

Give that a click and a banner will briefly flash to let you know it's done it job.

Banner flash on successful copy

Paste your output wherever you need it, depending on the page there will be two outcomes:

  • On a single video or short page you'll get just the URL from the video you are watching in this style
    I know there is the share button, this saves a couple of clicks.
  • On a playlist page or where multiple videos are diplayed you'll get a nice list like this:


If you are on a channels homepage and they have some sort of carousel/spinner thing, you'll only get the ID's for the items you can see, the others are not generated/rendered until you bring them into view. I decided to leave it there after coding it, but it's not much use on that page.


  • 🔲 Code optimisation: Code is fast enough but I'm sure there are a couple of things that could be better
  • 🔲 Add clipboard button to individual videos links, quickly grab individual URLs as well as whole page
  • ✅ Add auto update


Published under the The Unlicense

Help fuel my caffine habbit

If you fancy buying me a ☕ to say thanks, please visit my Ko-Fi page by hitting the button below.