Public/Get-TomGauld.ps1
function Get-TomGauld { param ( ) $AmericanCulture = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList 'en-US' Invoke-WebRequest -Uri 'https://www.newscientist.com/author/tom-gauld/' | Select-Object -ExpandProperty Links | Where-Object href -Like '/article/*' | ForEach-Object { $Url = "https://www.newscientist.com$($_.href)"; $Url } | ForEach-Object { ConvertTo-HtmlDocument -Uri $_ } | ForEach-Object { $DateText = $_ | Select-HtmlNode -CssSelector '.ArticleHeader__Date' | Get-HtmlNodeText $Date = [DateTime]::ParseExact($DateText, 'd MMMM yyyy', $AmericanCulture) $Title = $_ | Select-HtmlNode -CssSelector 'h1' | Get-HtmlNodeText $Image = ($_ | Select-HtmlNode -CssSelector 'figure.ArticleImage img').GetAttributeValue('data-src', '') [PSCustomObject][Ordered]@{ PSTypeName = 'UncommonSense.NewScientist.Article' Url = $Url Date = $Date Title = $Title Body = $Image } } } |