Public/Get-iPlayerFeatured.ps1
function Get-iPlayerFeatured { param() 1..2 | ForEach-Object { ConvertTo-HtmlDocument -Uri "https://www.bbc.co.uk/iplayer/group/featured?page=$_" | Select-HtmlNode -CssSelector '#tvip-script-app-store' | Select-Object -ExpandProperty InnerText | ForEach-Object { $_ -replace '^window\.__IPLAYER_REDUX_STATE__ = ', '' -replace ';$', '' } | ConvertFrom-Json -Depth 10 | Select-Object -ExpandProperty entities | Select-Object -ExpandProperty elements | ForEach-Object { [PSCustomObject]@{ PSTypeName = 'UncommonSense.iPlayer.Featured' ID = $_.id Title = $_.title SubTitle = $_.subtitle Synopsis = $_.synposes.large ?? $_.synopses.medium ?? $_.synopses.small Image = $_.images.promotional -replace '\{recipe\}', '304x171' Link = $_.related_links.url } } } } |