Public/Get-Sigmund.ps1
function Get-Sigmund { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' $Content = Invoke-WebRequest -Uri 'https://www.volkskrant.nl/nieuws-achtergrond/sigmund~b52ef491' ` | Select-Object -ExpandProperty Content $Dates = $Content | pup '.artstyle__main--container h3 text{}' --plain | ForEach-Object { $_.Trim() } | Where-Object { $_ } | ForEach-Object { [DateTime]::ParseExact($_, "d MMMM yyyy", $DutchCulture) } $Images = $Content | pup '.artstyle__main--container img attr{src}' $NoOfItems = ($Dates.Count), ($Images.Count) | Measure-Object -Minimum | Select-Object -ExpandProperty Minimum 0..($NoOfItems - 1) | ForEach-Object { [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Volkskrant.Article' Url = $Images[$_] Date = $Dates[$_] Title = 'Sigmund' Body = $Images[$_] } } } |