Public/Get-Oogopslag.ps1
function Get-Oogopslag { Invoke-WebRequest -Uri https://nrc.nl/rubriek/oogopslag ` | 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 $Image = $Document | Select-HtmlNode -CssSelector 'img' $DataSrc = $Image.GetAttributeValue('data-src', '') $DataSrcs = $DataSrc -split '\|' $LastDataSrc = $DataSrcs | Select-Object -Last 1 [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 ' ' Image = "https:$LastDataSrc" } } } Get-Oogopslag |