Public/Get-JoostPrinsen.ps1
function Get-JoostPrinsen { $DutchCulture = [cultureinfo]::GetCultureInfo('nl-NL') Invoke-WebRequest -Uri 'https://www.haarlemsdagblad.nl/zoeken?keyword=joost+prinsen' | Select-Object -ExpandProperty Links | Select-Object -ExpandProperty href | Where-Object { $_ -like '/cnt/dmf*' } | ForEach-Object { "https://haarlemsdagblad.nl$($_)" } | ForEach-Object { $CurrentUrl = $_ Invoke-WebRequest $CurrentUrl | Select-Object -ExpandProperty Content | pup 'script json{}' | ConvertFrom-Json | Where-Object text -Like 'window`["__PRE*' | Select-Object -First 1 -ExpandProperty Text | ForEach-Object { $_ -replace '^window\["__PRELOADED_STATE_GRAPH__[^"]*"\] = ', '' } | jq '..|.article? // empty' # | { title: .title, intro: ([.intro.p]|join(\" \")), body: ([.body.json[].p]|join(\" \"))}' | ConvertFrom-Json | Select-Object -Property Title, Intro, Body, PublishedAt | ForEach-Object { $Intro = ($_.Intro).p -join "`n" $Body = ($_.Body).p -join "`n" [PSCustomObject]@{ PSTypeName = 'UncommonSense.HaarlemsDagblad.Article' Url = $CurrentUrl Date = $_.PublishedAt Title = $_.Title -replace '\s\|\scolumn$', '' Body = @($Intro, $Body) -join "`n`n" } } } } |