Skip to content

Instantly share code, notes, and snippets.

@ShinNoNoir
Created March 25, 2015 14:35
Show Gist options
  • Select an option

  • Save ShinNoNoir/d59ca5da3cd5c554a832 to your computer and use it in GitHub Desktop.

Select an option

Save ShinNoNoir/d59ca5da3cd5c554a832 to your computer and use it in GitHub Desktop.
Simple PowerShell script to get the duration of a YouTube video
# 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
@C2N14
Copy link
Copy Markdown

C2N14 commented Aug 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment