Public/Get-JoostPrinsen.ps1
function Get-JoostPrinsen { Invoke-WebRequest -Uri 'https://www.haarlemsdagblad.nl/zoeken?keyword=joost+prinsen' | Select-Object -ExpandProperty Links | Select-Object -ExpandProperty Href | Where-Object { $_ -like '/cnt/dmf*' } | Select-Object -First 1 | ForEach-Object { "https://haarlemsdagblad.nl$($_)" } | ForEach-Object { $CurrentUrl = $_ ConvertTo-HtmlDocument -Uri $CurrentUrl | Select-HtmlNode -CssSelector 'script[data-fragment-type=ArticleContent]' | Select-Object -ExpandProperty InnerText | ForEach-Object { $_ -replace '^window\["__PRELOADED_STATE_GRAPH__[^"]*"\] = ', '' } | ConvertFrom-Json | Select-Object -ExpandProperty 1i96ydu | Select-Object -ExpandProperty data | Select-Object -ExpandProperty article | ForEach-Object { $Intro = $_.Intro | Select-Object -ExpandProperty p | Join-String -Separator "`n" $Body = $_.Body | Select-Object -ExpandProperty p | Join-String -Separator "`n" [PSCustomObject]@{ PSTypeName = 'UncommonSense.HaarlemsDagblad.Article' Url = $CurrentUrl Date = $_.PublishedAt Title = $_.Title -replace '\s\|\scolumn$', '' Body = @($Intro, $Body) -join "`n`n" } } } } Get-JoostPrinsen |