Created
March 25, 2015 14:35
-
-
Save ShinNoNoir/d59ca5da3cd5c554a832 to your computer and use it in GitHub Desktop.
Simple PowerShell script to get the duration of a YouTube video
This file contains hidden or 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
| # PowerShell V4 | |
| param( | |
| [String]$VideoId | |
| ) | |
| [String]$gdata_uri = "http://gdata.youtube.com/feeds/api/videos/$VideoId" | |
| $metadata = irm $gdata_uri | |
| $duration = $metadata.entry['media:group']['yt:duration'].seconds | |
| echo $duration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anyone coming from Google, as I did, this script no longer works because of the YouTube API change. I've fixed it here: https://gist.github.com/C2N14/339914ffab6cf16994f2f63e80dd1400