Powershell 批量抓取youtube搜索

Powershell 批量抓取youtube搜索,powershell,batch-file,youtube,web-crawler,batch-processing,Powershell,Batch File,Youtube,Web Crawler,Batch Processing,我有一个项目要去学校做批量脚本+powershell。 所以我的想法是询问用户他想在youtube上看到的视频 我向用户询问视频,我可以让它搜索。我将powershell运行到wget yt.com/results?search_query=Something并保存它 在此之后,我必须找到列表中的第一个视频,所以我需要批量找到它。我试过FINDSTR,但没能使它有用 我在代码中发现了只出现1次的内容,我知道这是我的视频,所以我需要找到: FINDSTR "<a aria-hidden=\"

我有一个项目要去学校做批量脚本+powershell。 所以我的想法是询问用户他想在youtube上看到的视频

我向用户询问视频,我可以让它搜索。我将powershell运行到wget yt.com/results?search_query=Something并保存它

在此之后,我必须找到列表中的第一个视频,所以我需要批量找到它。我试过FINDSTR,但没能使它有用

我在代码中发现了只出现1次的内容,我知道这是我的视频,所以我需要找到:

FINDSTR "<a aria-hidden=\"true\"  href=*" something.html > result.txt

FINDSTR”您的变量和命令在PowerShell中如下所示

$var = Read-Host 'Search for video'
$var = $var -replace ' ','+'

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