Netflix has partnered with Microsoft to create an OData API for the Netflix catalog information. Here it is OData Catalog API (Preview).
Assuming you have Windows 7 installed (PowerShell comes out of the box) and PowerShell Pack the script below should work.
If you don’t have Windows 7 no problem, you can download PowerShell Version 2 for your OS HERE.
The Viewer
Miguel de Icaza’s talks about NetFlix and OData in his post OData Client goes Open Source.
Here are some other ‘queries’ you can try in the viewer, just copy/paste it in the text box at the top and press enter.
- Name eq ‘The Name of The Rose’
- ReleaseYear le 1989 and ReleaseYear ge 1980 and AverageRating gt 4
- Type eq ‘Movie’ and Instant/Available eq true and (Rating eq ‘G’ or Rating eq ‘PG-13′)
- Type eq ‘Movie’ and Instant/Available eq true and (Rating ne ‘R’ and Rating ne ‘NC-17′ and Rating ne ‘UR’ and Rating ne ‘NR’)
- substringof(‘bank’,Synopsis) and ReleaseYear eq 2010
The Code
Function Get-NetFlixTitles { param ($filter) $url = "http://odata.netflix.com/Catalog/Titles?`$filter=" $wc = New-Object net.webclient $feed = [xml]($wc.downloadstring("$($url)$($filter)")) $feed | select -ExpandProperty feed | select -ExpandProperty entry | ForEach { New-Object PSObject -Property @{ Title = $_.title.'#text' Url = $_.properties.TinyUrl } } } Import-Module wpk New-Window -Title "NetFlix OData" -WindowStartupLocation CenterScreen -Width 1200 -Height 600 -Show -On_Loaded { $lstBox = $window | Get-ChildControl lstBox $lstBox.ItemsSource = @(Get-NetFlixTitles "ReleaseYear eq 2010") } { New-Grid -Rows 32, 1* -Columns 300, 900* { New-TextBox -Name txtBox -Text "ReleaseYear eq 2010" -Row 0 -ColumnSpan 2 -Margin 3 -On_PreviewKeyUp { if($_.Key -eq "Enter") { $lstBox = $window | Get-ChildControl lstBox $txtBox = $window | Get-ChildControl txtBox $lstBox.ItemsSource = @(Get-NetFlixTitles "$($txtBox.Text)") } } New-ListBox -Name lstBox -Row 1 -Column 0 -DisplayMemberPath Title ` -On_SelectionChanged { $browser = $window | Get-ChildControl browser $browser.Source = $this.SelectedItem.Url } New-WebBrowser -Name browser -Column 1 -Row 1 } }



{ 3 trackbacks }
{ 1 comment… read it below or add one }
Thanks Doug,
for providing WPK eamples