Public/Get-GooglePlayApplication.ps1
<#
.COPYRIGHT Copyright (c) Office Center Hønefoss AS. All rights reserved. Licensed under the MIT license. See https://github.com/officecenter/OCH-Public/blob/master/LICENSE for license information. #> Function Get-GooglePlayApplication { Param( [Parameter(Mandatory = $true)] [String] $BundleId, [String] $Country = 'no' ) $appStoreUrl = "https://play.google.com/store/apps/details?id={0}&hl={1}" -F $BundleId, $Country $appStorePage = Invoke-WebRequest -Uri $appStoreUrl $IconUrl = 'https:' + ($appStorePage.images | Where-Object {$_.alt -eq 'Cover art'}).src $Description = $appStorePage.ParsedHtml.title $DisplayName = ($appStorePage.ParsedHtml.getElementsByTagName('h1') | Where-Object {$_.classname -eq 'document-title'}).InnerText $Publisher = ($appStorePage.ParsedHtml.getElementsByTagName('a') | Where-Object {$_.classname -eq 'document-subtitle primary'}).TextContent $operatingSystems = ($appStorePage.ParsedHtml.getElementsByTagName('div') | Where-Object {$_.classname -eq 'content' -and $_.OuterHTML -like "*operatingSystems*"}).InnerText If ($operatingSystems -match "(\d+\.)+\d+\b") { $osVersion = 'v{0}'-F $Matches[0] -replace '\.','_' } New-AndroidApplication -DisplayName $DisplayName -Description $Description -Publisher $Publisher -IconUrl $IconUrl -AppstoreUrl $appStoreUrl -IsFeatured -MinimumOsVersion $osVersion } |