Created
November 22, 2015 03:21
-
-
Save specious/77a22811bb1bef93b289 to your computer and use it in GitHub Desktop.
Shortens a YouTube URL
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
#!/usr/bin/env node | |
if( process.argv.length > 2 ) { | |
var video_id = /(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/.exec( process.argv[2] )[5] | |
console.log( "http://youtu.be/" + video_id ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment