Public/Get-IonicaSmeets.ps1
<# .SYNOPSIS Retrieves recent articles by Ionica Smeets #> function Get-IonicaSmeets { $DutchCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'nl-NL' Invoke-WebRequest -Uri https://www.volkskrant.nl/auteur/ionica-smeets ` | Select-Object -ExpandProperty Content ` | pup 'article a attr{href}' ` | ForEach-Object { $Url = "https://volkskrant.nl$($_)" $Content = Invoke-WebRequest -Uri $Url | Select-Object -ExpandProperty Content $Title = $Content | pup 'h1 text{}' --plain | ForEach-Object { $_.Trim() } | Where-Object { $_ } $Body = $Content | pup 'section.artstyle__main--container p text{}' --plain | ForEach-Object { $_.Trim() } | Where-Object { $_ } | ForEach-Object { $_; '' } $DateText = $Content | pup 'time span:first-child text{}' $Date = [DateTime]::ParseExact($DateText, 'd MMMM yyyy', $DutchCulture) [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.Volkskrant.Article' Url = $Url Date = $Date Title = $Title Body = $Body } } } |