Apps/Get-Opera.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$Architectures = @('x64','i386')

foreach ($Architecture in $Architectures) {
    try {

        $Redirect = (Resolve-Uri -Uri "https://download.opera.com/download/get/?partner=www&opsys=Windows&download_url=&arch=$Architecture").Uri

        if ($Redirect -match 'id=(\d+)') {
            $URL = (Resolve-Uri -Uri "https://download.opera.com/download/get/?id=$($matches[1])&nothanks=yes").Uri
            $Version = $URL | Get-Version
            if ($Architecture -eq 'i386') { $Architecture = 'x86'}
            New-NevergreenApp -Name 'Opera' -Version $Version -Uri $URL -Architecture $Architecture -Type 'Exe'
        }

    }
    catch {
        Write-Error "$($MyInvocation.MyCommand): $($_.Exception.Message)"
    }
}