Public/Get-Picl.ps1
function Get-Picl { [CmdletBinding()] param() $DutchCulture = Get-Culture 'nl-NL' Invoke-WebRequest -Uri 'https://picl.nl/films/' | Select-Object -ExpandProperty Links | Select-Object -ExpandProperty Href | Where-Object { $_ -match '^https://picl.nl/films/.+$' } | ForEach-Object { $Url = $_ $Document = ConvertTo-HtmlDocument -Uri $Url $Title = $Document | Select-HtmlNode -CssSelector 'h1' | Get-HtmlNodeText $Synopsis = $Document | Select-HtmlNode -CssSelector '.movie-hero__intro' | Get-HtmlNodeText $Description = $Document | Select-HtmlNode -CssSelector '.movie__description p' | Get-HtmlNodeText $Meta = $Document | Select-HtmlNode -CssSelector '.movie-meta p' -All $AvailableUntilText = $Meta[0] | Get-HtmlNodeText $AvailableUntil = [DateTime]::ParseExact($AvailableUntilText, 'd MMMM yyyy', $DutchCulture) $Genre = $Meta[1] | Get-HtmlNodeText $Country = $Meta[2] | Get-HtmlNodeText $Language = $Meta[3] | Get-HtmlNodeText [PSCustomObject]@{ PSTypeName = 'UncommonSense.Cinema.PiclFilm' Url = $Url Title = $Title Synopsis = $Synopsis Description = $Description Genre = $Genre Country = $Country Language = $Language AvailableUntilText = $AvailableUntilText AvailableUntil = $AvailableUntil } } } |