Private/Get-NrcArticle.ps1
function Get-NrcArticle { param ( [Parameter(Mandatory)] [string]$Uri ) Invoke-WebRequest -Uri $Uri ` | Select-Object -ExpandProperty Links ` | Select-Object -ExpandProperty HRef ` | Where-Object { $_ -like '/nieuws/*' } | ForEach-Object { $Url = "https://www.nrc.nl$($_)" $DateText = (($Url -split '/')[4..6]) -join '-' $Document = ConvertTo-HtmlDocument -Uri $Url [PSCustomObject]@{ PSTypeName = 'UncommonSense.Nrc.Article' Url = $Url Date = [DateTime]::ParseExact($DateText, 'yyyy-MM-dd', $null) Title = ($Document | Select-HtmlNode -CssSelector 'h1[data-flowtype="headline"]').InnerText Body = ($Document | Select-HtmlNode -CssSelector 'div.content p' -All | Select-Object -SkipLast 1).InnerText -join ' ' } } } |