Public/Get-Gummbah.ps1
<# .SYNOPSIS Retrieves recent cartoons by Gummbah #> function Get-Gummbah { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' $Content = Invoke-WebRequest -Uri 'https://www.volkskrant.nl/cultuur-media/gummbah~b3681e20/' ` | Select-Object -ExpandProperty Content $Dates = $Content | pup '.artstyle__main--container .artstyle__paragraph text{}' --plain | ForEach-Object { $_.Trim() } | Where-Object { $_ } | ForEach-Object { if ($_ -eq '11 september') { '11 september 2021' } else { $_ } } | 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 = 'Gummbah' Body = $Images[$_] } } } |