Public/Get-HeinDeKort.ps1
function Get-HeinDeKort { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' Invoke-WebRequest -Uri 'https://www.parool.nl/gs-b738ae8f' ` | Select-Object -ExpandProperty Content ` | pup 'figure img json{}' --plain ` | ConvertFrom-Json | ForEach-Object { $Date = [DateTime]::Empty $DateText = $_.'data-title' -replace '\.$', '' -replace '^\s+', '' -replace '\s+$', '' $Formats = @('d MMMM yyyy', 'dddd d MMMM') [DateTime]::TryParseExact($DateText, $Formats, $DutchCulture, [System.Globalization.DateTimeStyles]'None', [ref]$Date) [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Parool.Article' Url = $_.'data-original' Date = $Date Title = 'Hein de Kort' Body = $_.'data-original' } } } |