Public/Get-Ikje.ps1
function Get-Ikje { Invoke-WebRequest -Uri https://www.nrc.nl/rubriek/ikje ` | 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 ' ' } } } |