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 props | ForEach-Object { [PSCustomObject]@{ PSTypeName = 'UncommonSense.iPlayer.Featured' Genre = $_.secondaryLabel Title = $_.title SubTitle = $_.subtitle Synopsis = $_.synopsis Image = $_.imageTemplate Link = $_.href } } } } |