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://nrc.nl$($_)" $DateElements = ($Url -split '/')[4..6] $Document = ConvertTo-HtmlDocument -Uri $Url [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Nrc.Article' Url = $Url Date = Get-Date -Year $DateElements[0] -Month $DateElements[1] -Day $DateElements[2] Title = ($Document | Select-HtmlNode -CssSelector 'h1[data-flowtype="headline"]').InnerText Body = ($Document | Select-HtmlNode -CssSelector 'div.content p' -All).InnerText -join ' ' } } } |