DanGough / Nevergreen

This module is an alternative to Evergreen, and allows you to find the latest version and download URL for various Windows apps. Evergreen uses API queries to obtain its data whereas this module is more focussed on web scraping. This is more prone to breaking when websites are changed, hence the name.
The Unlicense
71 stars 16 forks source link

[New App Request] Alludo WinZip (On Proposals list) #100

Open AScott-WWF opened 2 days ago

AScott-WWF commented 2 days ago

Script:

# Get-AlludoWinZip.ps1

# Define AppName
$AppName = "Winzip"

$ReleaseUrl = "https://www.winzip.com/en/pages/download/winzip/"

Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"

# Main script to fetch and process links
$AppVersions = @(
    @{AppName = $($AppName); Architecture = 'x64'; Type = 'exe'; Pattern = '\.exe'; VersionPattern = 'winzip(\d+)\.exe'}
)

foreach ($AppVersion in $AppVersions) {
    $SearchCount = 1 # This may need increasing as future versions are released

    #Build each link with File Type specific versions
    $URL = (Get-Link -Uri $ReleaseUrl -MatchProperty href -Pattern $AppVersion.Pattern)
    $Version = Get-Version -String $URL -Pattern $AppVersion.VersionPattern

    do {
        if ($URL) {
            New-NevergreenApp -Name $($AppVersion.AppName) -Architecture $($AppVersion.Architecture) -Version $($Version) -Uri $($URL) -Type $($AppVersion.Type)
            break
        }

        $SearchCount--
    } until ($SearchCount -eq 0)

    if ($SearchCount -eq 0) {
        Write-Warning "Could not find release for $($AppName) $($AppVersion.Type)"
    }
}

$ReleaseNotesUrl = "https://kb.winzip.com/help/help_whatsnew.htm"
Write-Verbose "$($AppName) (Version: $($Version)) release notes are available here: $($ReleaseNotesUrl)"