Private/Get-NrcCartoon.ps1
function Get-NrcCartoon { param ( [Parameter(Mandatory)] [string]$Uri, [Parameter(Mandatory)] [string]$Title ) 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] $Image = Invoke-WebRequest $Url | Select-Object -ExpandProperty Images | Select-Object -ExpandProperty Src [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Nrc.Article' Url = $Url Date = Get-Date -Year $DateElements[0] -Month $DateElements[1] -Day $DateElements[2] Title = $Title Body = $Image } } } |