[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[转载代码] [PowerShell每日技巧]从YouTube上搜索、查看PowerShell视频(20131225)

PowerShell is amazing. It will let you search YouTube videos for keywords you select, then offer the videos to you, and upon selection play the videos as well.

Here's a little script that--Internet access assumed--lists the most recent "Learn PowerShell" videos from YouTube. The list opens in a grid view window, so you can use the full text search at the top or sort columns until you find the video you want to give a try.

Next, click the video to select it, and then click "OK" in the lower-right corner of the grid.

PowerShell will launch your web browser and play the video. Awesome!
  1. $keyword = "Learn PowerShell"
  2. Invoke-RestMethod -Uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=$($keyword.Replace(' ','+'))" |
  3. Select-Object -Property Title, @{N='Author';E={$_.Author.Name}}, @{N='Link';E={$_.Content.src}}, @{N='Updated';E={[DateTime]$_.Updated}} |
  4. Sort-Object -Property Updated -Descending |
  5. Out-GridView -Title "Select your '$Keyword' video, then click OK to view." -PassThru |
  6. ForEach-Object { Start-Process $_.Link }
复制代码
Simply change the variable $keyword in the first line to search for different videos or topics.

Note that due to a bug in PowerShell 3.0, Invoke-RestMethod will only return half of the results. In PowerShell 4.0, this bug was fixed.

http://powershell.com/cs/blogs/tips/archive/2013/12/25/search-and-view-powershell-videos.aspx

返回列表