# Define the target URL # $targetUrl = "https://www.nasa.gov/history/alsj/a11/video11.html" $targetUrl = Read-Host "Enter the target URL to scan for video links" # Define the folder to save downloads $downloadFolder = "V:\INTERNET\nasa\powershell" New-Item -ItemType Directory -Path $downloadFolder -Force | Out-Null # Define video extensions to look for $videoExtensions = @(".mp4", ".webm", ".mov", ".avi", ".mkv", ".flv", ".rm") # Fetch the HTML content $response = Invoke-WebRequest -Uri $targetUrl # Extract all href links $links = $response.Links | Where-Object { $ext = [System.IO.Path]::GetExtension($_.href) $videoExtensions -contains $ext.ToLower() } # Download each video file using curl foreach ($link in $links) { $url = $link.href if ($url -notmatch "^https?://") { # Convert relative URL to absolute $uri = [System.Uri]::new($targetUrl, $url) $url = $uri.AbsoluteUri } $fileName = [System.IO.Path]::GetFileName($url) $outputPath = Join-Path $downloadFolder $fileName Write-Host "Downloading $fileName..." curl.exe -L $url -o $outputPath }