Public/Get-TienGeboden.ps1
function Get-TienGeboden { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' Invoke-WebRequest -Uri https://www.trouw.nl/dossier/tien-geboden ` | Select-Object -ExpandProperty Content ` | pup 'article > a:first-of-type attr{href}' --plain ` | ForEach-Object { $Url = "https://www.trouw.nl$($_)" $Content = Invoke-WebRequest -Uri $Url | Select-Object -ExpandProperty Content $DateText = $Content | pup 'time text{}' --plain [PSCustomObject]@{ PSTypeName = 'UncommonSense.Trouw.Article' Url = $Url Date = [DateTime]::ParseExact($DateText, 'd MMMM yyyy , H:mm', $DutchCulture) Title = (($Content | pup 'h1 text{}' --plain) -join ' ').Trim() Body = ($Content | pup '.artstyle__main p text{}' --plain) -join "`n" } Start-Sleep -Seconds 1 # Prevent nginx 429 error (too many requests) } } |