I had a page that had a ton of Youtube videos that I needed to get my hands on (for an educational course). RegEx is a great way to do this.

Following are the steps I followed to get this done!

  • Browse to the page source using the below format in the Google Chrome Address Bar
view-source:URL_HERE
((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)
  • Copy the results from the bottom tab!

  • Paste the results into Sublime and remove the stuff thats unnecessary using Sublime Text magic!

  • Download videos using you-get

My commands that I pasted into my bash shell looked like this (these have been faked below)! ;-)

you-get "https://www.youtube.com/watch?v=YyEZG2RgNnMIb"
you-get "https://www.youtube.com/watch?v=rRw"
you-get "https://www.youtube.com/watch?v=bwpqjJNj"
you-get "https://www.youtube.com/watch?v=L0AuY0DEsr5o1"
you-get "https://www.youtube.com/watch?v=uMkwju2c"
you-get "https://www.youtube.com/watch?v=wsKP8lNlIkmFnjad7"
you-get "https://www.youtube.com/watch?v=HGnnQmvV"
you-get "https://www.youtube.com/watch?v=Q8fXYBIzN4nalNbx1F"
you-get "https://www.youtube.com/watch?v=du0Zi14p2LAEbAl"
you-get "https://www.youtube.com/watch?v=iMXN4R2llWksaiuN5xvY"
you-get "https://www.youtube.com/watch?v=fuquwxQeFsoHR2vOJK"