Public/Get-Spotprent.ps1
function Get-Spotprent { $DutchCulture = Get-Culture 'nl-NL' $PreviousDate = [DateTime]::MaxValue Invoke-WebRequest -Uri https://www.trouw.nl/achterpagina/spotprenten~bc9b7dca/ | Select-Object -ExpandProperty Images | Where-Object Src -Like 'https://image.trouw.nl/*' | Select-Object -ExpandProperty Src | ForEach-Object { $Url = $_ $DateText = ($_ -split '/')[-1] $Date = [DateTime]::ParseExact($DateText, 'd-MMMM', $DutchCulture) if ($Date -gt $PreviousDate) { $Date = $Date.AddYears(-1) } [PSCustomObject]@{ PSTypeName = 'UncommonSense.Trouw.Article' Url = $Url Date = $Date Title = 'Spotprent' Body = $Url } $PreviousDate = $Date } } |