Public/Get-BcTechDaysSchedule.ps1
function Get-BcTechDaysSchedule { $EnglishCulture = [cultureinfo]'en-US'; $BrusselsTimeZone = [System.TimeZoneInfo]::FindSystemTimeZoneById('Europe/Brussels') $Property = [Ordered]@{ DateTime = 'h5.modal-title' Title = 'h2.text-color-secondary' Speakers = 'h2.accordion-header button' Tags = 'span.tag' Description = '.pt-3 p' } ConvertTo-HtmlDocument -Uri https://bctechdays.com/event | Select-HtmlNode -CssSelector '.modal[aria-labelledby^="event-detail-"] .modal-content' -All | Convert-HtmlNode -Property $Property -TypeName 'UncommonSense.BcTechDays.ScheduledEvent' -Mode CssSelector -Separator '***' | Where-Object DateTime -Like '*Jun*' | Where-Object { $_.Tags -notlike 'Workshop*' } | Where-Object Title -NotMatch '^\w{3}\s\d+$' | ForEach-Object { [DateTime]$Date = (Get-Date) if ([DateTime]::TryParseExact($_.DateTime.SubString(0, 11), 'ddd dd\, MMM', $EnglishCulture, [System.Globalization.DateTimeStyles]'None', [ref]$Date)) { $StartTimeText = $_.DateTime.SubString(12, 5) $StartTime = [DateTime]::ParseExact($StartTimeText, 'HH:mm', $EnglishCulture).TimeOfDay $EndTimeText = $_.DateTime.SubString(20, 5) $EndTime = [DateTime]::ParseExact($EndTimeText, 'HH:mm', $EnglishCulture).TimeOfDay $Tags = $_.Tags -split '\*\*\*' [PSCustomObject]@{ RawDateTime = $_.DateTime StartDate = ([TimeZoneInfo]::ConvertTimeToUtc($Date.Add($StartTime), $BrusselsTimeZone)) EndDate = ([TimeZoneInfo]::ConvertTimeToUtc($Date.Add($EndTime), $BrusselsTimeZone)) Title = $_.Title RawTags = $Tags Type = $Tags | Where-Object { $_ -in 'Session', 'Workshop', 'Presentation' } Duration = $Tags | Where-Object { $_ -match '\d+\smin' } Location = $Tags | Where-Object { $_ -Match '^Room\s\d+$' -or $_ -eq 'Conference Hotel' -or $_ -eq 'Expo Area' -or $_ -eq 'Presentations Area' } Level = $Tags | Where-Object { $_ -match '^LEVEL' } | ForEach-Object { $_ -replace '^LEVEL:\s', '' } Speakers = $_.Speakers -split '\*\*\*' -join ', ' Description = $_.Description -split '\*\*\*' -join "`n" } } } } |