powershell을 사용하여 채널 9 시리즈를 다운로드해야하지만 시도한 스크립트에 오류가 있습니다.
이 스크립트
$url="https://channel9.msdn.com/blogs/OfficeDevPnP/feed/mp4high" $rss=invoke-webrequest -uri $url $destination="D:\Videos\OfficePnP" [xml]$rss.Content|foreach{ $_.SelectNodes("rss/channel/item/enclosure") }|foreach{ "Checking $($_.url.split("/")[-1]), we will skip it if it already exists in $($destination)" if(!(test-path ($destination + $_.url.split("/")[-1]))){ "Downloading: " + $_.url start-bitstransfer $_.url $destination } }
오류로 인해 실패 :
Internet Explorer 엔진을 사용할 수 없거나 Internet Explorer의 첫 실행 구성이 완료되지 않았기 때문에 응답 콘텐츠를 구문 분석 할 수 없습니다. UseBasicParsing 매개 변수를 지정하고 다시 시도하십시오.
나는 또한 이것을 시도했다
# --- settings --- $feedUrl = "https://channel9.msdn.com/blogs/OfficeDevPnP/feed/mp4high" $mediaType = "mp4high" $overwrite = $false $destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "OfficeDevPnP" # --- locals --- $webClient = New-Object System.Net.WebClient # --- functions --- function PromptForInput ($prompt, $default) { $selection = read-host "$prompt`r`n(default: $default)" if ($selection) {$selection} else {$default} } function DownloadEntries { param ([string]$feedUrl) $feed = [xml]$webClient.DownloadString($feedUrl) $progress = 0 $pagepercent = 0 $entries = $feed.rss.channel.item.Length $invalidChars = [System.IO.Path]::GetInvalidFileNameChars() $feed.rss.channel.item | foreach { $url = New-Object System.Uri($_.enclosure.url) $name = $_.title $extension = [System.IO.Path]::GetExtension($url.Segments[-1]) $fileName = $name + $extension $invalidchars | foreach { $filename = $filename.Replace($_, ' ') } $saveFileName = join-path $destinationDirectory $fileName $tempFilename = $saveFilename + ".tmp" $filename if ((-not $overwrite) -and (Test-Path -path $saveFileName)) { write-progress -activity "$fileName already downloaded" -status "$pagepercent% ($progress / $entries) complete" -percentcomplete $pagepercent } else { write-progress -activity "Downloading $fileName" -status "$pagepercent% ($progress / $entries) complete" -percentcomplete $pagepercent $webClient.DownloadFile($url, $tempFilename) rename-item $tempFilename $saveFileName } $pagepercent = [Math]::floor((++$progress)/$entries*100) } } # --- do the actual work --- [string]$feedUrl = PromptForInput "Enter feed URL" $feedUrl [string]$mediaType = PromptForInput "Enter media type`r`n(options:Wmv,WmvHigh,mp4,mp4high,zune,mp3)" $mediaType $feedUrl += $mediaType [string]$destinationDirectory = PromptForInput "Enter destination directory" $destinationDirectory # if dest dir doesn't exist, create it if (!(Test-Path -path $destinationDirectory)) { New-Item $destinationDirectory -type directory } DownloadEntries $feedUrl
너무 많은 오류