diff --git a/Record-Mic-to-Discord/main.ps1 b/Record-Mic-to-Discord/main.ps1 index e51cb6c..d383e33 100644 --- a/Record-Mic-to-Discord/main.ps1 +++ b/Record-Mic-to-Discord/main.ps1 @@ -13,15 +13,20 @@ param ([int[]]$t) $Path = "$env:Temp\ffmpeg.exe" If (!(Test-Path $Path)){ -$zipUrl = 'https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.0-essentials_build.zip' $tempDir = "$env:temp" -$zipFilePath = Join-Path $tempDir 'ffmpeg-7.0-essentials_build.zip' -$extractedDir = Join-Path $tempDir 'ffmpeg-7.0-essentials_build' +$apiUrl = "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest" +$response = Invoke-WebRequest -Uri $apiUrl -Headers @{ "User-Agent" = "PowerShell" } -UseBasicParsing +$release = $response.Content | ConvertFrom-Json +$asset = $release.assets | Where-Object { $_.name -like "*essentials_build.zip" } +$zipUrl = $asset.browser_download_url +$zipFilePath = Join-Path $tempDir $asset.name +$extractedDir = Join-Path $tempDir ($asset.name -replace '.zip$', '') Invoke-WebRequest -Uri $zipUrl -OutFile $zipFilePath Expand-Archive -Path $zipFilePath -DestinationPath $tempDir -Force Move-Item -Path (Join-Path $extractedDir 'bin\ffmpeg.exe') -Destination $tempDir -Force Remove-Item -Path $zipFilePath -Force Remove-Item -Path $extractedDir -Recurse -Force +Write-Output "FFmpeg has been downloaded and extracted to $tempDir" } sleep 1