Public/Get-Dirkjan.ps1
function Get-DirkJan { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' Invoke-WebRequest -Uri 'https://www.parool.nl/ps/dirkjan~b8731189/' ` | Select-Object -ExpandProperty Content ` | pup 'figure img json{}' --plain ` | ConvertFrom-Json | ForEach-Object { $DateText = $_.'data-title' $DateText = $DateText -replace '\.$', '' # trailing full stops $DateText = $DateText -replace '^\s+', '' # leading whitespace $DateText = $DateText -replace '\s+$', '' # trailing whitespace $DateText = $DateText.ToLowerInvariant() $Date = Get-Date if ([DateTime]::TryParseExact($DateText, 'd MMMM yyyy', $DutchCulture, [System.Globalization.DateTimeStyles]::None, [ref]$Date)) { [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Parool.Article' Url = $_.'data-original' Date = $Date Title = 'Dirkjan' Body = $_.'data-original' } } } } |