PowerTip: Search for YouTube Videos

PowerTip: Search for YouTube Videos

  • Comments 2
  • Likes

Summary: Learn how to use Windows PowerShell to search YouTube videos.

Hey, Scripting Guy! Question How can I search for YouTube videos about Desired State Configuration in Windows PowerShell 4.0?

Hey, Scripting Guy! Answer Use Invoke-RestMethod:

Invoke-RestMethod -uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=Desired+State+Configuration+PowerShell" 

The following command lists each video by title, author, and link:

Invoke-RestMethod -uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=Desired+State+Configuration+PowerShell" |
foreach {[PSCustomObject]@{Title=$_.Title; Author=$_.author.name; Link=$_.content.src}} | Format-List

Prefer a function for your profile?

function Get-DSCVideos {

Invoke-RestMethod -uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=Desired+State+Configuration+PowerShell" |
foreach {[PSCustomObject]@{Title=$_.Title; Author=$_.author.name; Link=$_.content.src}} | Format-List }

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment