jonbcampos / Netflix-AS3

AS3 implementation of the Netflix API
http://unitedmindset.com/jonbcampos
6 stars 0 forks source link

Getting title details #1

Open samelie opened 13 years ago

samelie commented 13 years ago

Hi Jon,

This work is incredible and invaluable for a noobie like myself.

My question is this:

After having logged in, requested a token and sent a title to netflix via the getCatalogListByTitle method, I see that I can retrieve bits of information by doing event.result[0].averageRating, returning 3.6 for exemple.

However, say I want to get the synopsis of a film, the only information returned is a url string like: http://api.netflix.com/catalog/titles/movies/60034390/synopsis

How do I get the data from this url?

Thanks so much for your work,

Sam

jonbcampos commented 13 years ago

You will need to "expand" the request. Use the CatalogItem.EXPAND_x in the expansion string to expand the item you are interested in. You can also expand multiple properties by making the expansion string: 'expand1,expand2,expand3'

J

On Wed, Jul 27, 2011 at 9:51 AM, swagnag < reply@reply.github.com>wrote:

Hi Jon,

This work is incredible and invaluable for a noobie like myself.

My question is this:

After having logged in, requested a token and sent a title to netflix via the getCatalogListByTitle method, I see that I can retrieve bits of information by doing event.result[0].averageRating, returning 3.6 for exemple.

However, say I want to get the synopsis of a film, the only information returned is a url string like: http://api.netflix.com/catalog/titles/movies/60034390/synopsis

How do I get the data from this url?

Thanks so much for your work,

Sam

Reply to this email directly or view it on GitHub: https://github.com/jonbcampos/Netflix-AS3/issues/1

Jonathan Campos Dallas Flex User Group Manager http://www.d-flex.org/ blog: http://www.unitedmindset.com/jonbcampos twitter: http://www.twitter.com/jonbcampos

samelie commented 13 years ago

Hi Jon,

Thanks for getting back to me.

Pardon my ignorance, but I am confused; what is the expansion string? Would it be possible to post code sample code that I could learn from as I am not entirely sure the order of things after the authentication.

Thanks for your help,

Sam

EDIT: Been looking at the class files trying to work what does what, but no real progress... Everything I know is from Tour de Flex and what you posted in the google group.

jonbcampos commented 13 years ago

So if you are using an expansion to pull additional details it would be as such:

getCatalogListByTitle("salt", 0, 25, "@synopsis,@box_art");

Which will extend the synopsis and box art.

You can also use the constants I've set for you

var expansions:String = CatalogItemVO.EXPAND_SYNOPSIS+","+CatalogItemVO.EXPAND_CAST;

This way you only pull back the additional data you want and not all the data. It's a lean way to get details.

On Fri, Jul 29, 2011 at 9:29 AM, swagnag < reply@reply.github.com>wrote:

Hi Jon,

Thanks for getting back to me.

Pardon my ignorance, but I am confused; what is the expansion string? Would it be possible to post code sample code that I could learn from as I am not entirely sure the order of things after the authentication.

Thanks for your help,

Sam

Reply to this email directly or view it on GitHub: https://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-1681624

Jonathan Campos Dallas Flex User Group Manager http://www.d-flex.org/ blog: http://www.unitedmindset.com/jonbcampos twitter: http://www.twitter.com/jonbcampos

samelie commented 13 years ago

Thanks for helping me out, I really appreciate it as I really do wanna get to grips with this api.

I was using an old swc off the google groups, hence why I wasn't getting prompted with the expansion perams on TitleService. I've got the latest version now. Does this mean the sample code there is outdated?

The bad news is I am still failing hard at getting anything working beyond the resultHandler from TitleService.

So far I have just ripped what you wrote:

private function initApp():void { var service:AuthenticationService = new AuthenticationService(); service.addEventListener(AuthenticationResultEvent.RESULT, _authorizationService_ResultHandler); service.addEventListener(NetflixFaultEvent.FAULT, _netflixService_FaultHandler); service.requestToken("KEY","SECRET"); // error says expected no more than 1, what is callBackUrl? This is new. }

private function _authorizationService_ResultHandler(event:AuthenticationResultEvent):void { var service:TitlesService = new TitlesService(); service.addEventListener(NetflixResultEvent.ADVANCED_TITLE_RESULT, _autoCompleteService_ResultHandler); // is this constant right? service.addEventListener(NetflixFaultEvent.FAULT, _autoCompleteService_FaultHandler); service.getCatalogListByTitle("salt", 0, 25,"@synopsis","@box_art");
}

private function _autoCompleteService_ResultHandler(event:NetflixResultEvent):void { MonsterDebugger.trace(this, event.result[0]); // I am intrigued by CatalogItemVO, how would I implement it at this point? // I guess I wanna pull all the data from a film I possibly can. // I can see the the 'availableExpansions' property }

This is not a flex project by the way. Working in flash builder but under Actionscript project, does that matter?

Apart from the error at requestToken(), I am also getting 2 errors:

1172: Definition mx.binding:BindingManager could not be found. ServiceStorage.as /NetflixTest/src/com/netflix/webapis/services line 1 Flex Problem

1172: Definition mx.collections:ArrayCollection could not be found. LinkItemVO.as /NetflixTest/src/com/netflix/webapis/vo line 24 Flex Problem

I've added the flex.swc to the build path but to no avail has this helped.

Sorry for the long post Jon, I know you must be a busy guy. I'll send you a beer :)

Thanks again,

Sam

samelie commented 13 years ago

I suppose to give you some project context...

I've got a mysql database of every movie on imdb. User clicks, generates random numder, use amfphp to retrieve the title from database WHERE movieNumber = randomNum want to run the movie title through netflix and get all the data I can on it.

I still cant get any info if its a LinkedItem though... :(

jonbcampos commented 13 years ago

Make sure you are using the code off of github. That will be much better for you.

There shouldn't be requirements for Flex in the code, though you will need to include all the code into your project.

The sample code isn't outdate, but it is much better.

The callbackURL sends the url to another site when the authentication is complete. So if you can watch the webpage you should be good to know when authentication is done.

What are you trying to do? Just get movie info?

On Mon, Aug 1, 2011 at 10:21 AM, swagnag < reply@reply.github.com>wrote:

Thanks for helping me out, I really appreciate it as I really do wanna get to grips with this api.

I was using an old swc off the google groups, hence why I wasn't getting prompted with the expansion perams on TitleService. I've got the latest version now. Does this mean the sample code there is outdated?

The bad news is I am still failing hard at getting anything working beyond the resultHandler from TitleService.

So far I have just ripped what you wrote:

private function initApp():void { var service:AuthenticationService = new AuthenticationService(); service.addEventListener(AuthenticationResultEvent.RESULT, _authorizationService_ResultHandler); service.addEventListener(NetflixFaultEvent.FAULT, _netflixService_FaultHandler); service.requestToken("KEY","SECRET"); // error says expected no more than 1, what is callBackUrl? This is new. }

private function _authorizationService_ResultHandler(event:AuthenticationResultEvent):void { var service:TitlesService = new TitlesService(); service.addEventListener(NetflixResultEvent.ADVANCED_TITLE_RESULT, _autoCompleteService_ResultHandler); // is this constant right? service.addEventListener(NetflixFaultEvent.FAULT, _autoCompleteService_FaultHandler); service.getCatalogListByTitle("salt", 0, 25,"@synopsis","@box_art"); }

private function _autoCompleteService_ResultHandler(event:NetflixResultEvent):void { MonsterDebugger.trace(this, event.result[0]); // I am intrigued by CatalogItemVO, how would I implement it at this point? // I guess I wanna pull all the data from a film I possibly can. // I can see the the 'availableExpansions' property }

This is not a flex project by the way. Working in flash builder but under Actionscript project, does that matter?

Apart from the error at requestToken(), I am also getting 2 errors:

1172: Definition mx.binding:BindingManager could not be found. ServiceStorage.as /NetflixTest/src/com/netflix/webapis/services line 1 Flex Problem

1172: Definition mx.collections:ArrayCollection could not be found. LinkItemVO.as /NetflixTest/src/com/netflix/webapis/vo line 24 Flex Problem

I've added the flex.swc to the build path but to no avail has this helped.

Sorry for the long post Jon, I know you must be a busy guy. I'll send you a beer :)

Thanks again,

Sam

Reply to this email directly or view it on GitHub: https://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-1701136

Jonathan Campos Dallas Flex User Group Manager http://www.d-flex.org/ blog: http://www.unitedmindset.com/jonbcampos twitter: http://www.twitter.com/jonbcampos

jonbcampos commented 13 years ago

Ya, then don't use Netflix API. There are lots of steps for authentication and you'll easily run into api daily limits. Try the rotten tomatoes api, much much easier.

https://github.com/jonbcampos/RottenTomatoesAS3

On Mon, Aug 1, 2011 at 10:27 AM, swagnag < reply@reply.github.com>wrote:

I suppose to give you some project context...

I've got a mysql database of every movie on imdb. User clicks, generates random numder, use amfphp to retrieve the title from database WHERE movieNumber = randomNum want to run the movie title through netflix and get all the data I can on it.

I still cant get any info if its a LinkedItem though... :(

Reply to this email directly or view it on GitHub: https://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-1701181

Jonathan Campos Dallas Flex User Group Manager http://www.d-flex.org/ blog: http://www.unitedmindset.com/jonbcampos twitter: http://www.twitter.com/jonbcampos

samelie commented 13 years ago

BOOM! Gatta say man, your code is so easy and great. The rotten tomatoes api you set us was super effective. The main reason I was thinkin of using Netflix was to offer users the possibility to see once they clicked a random movie whether they watch it over netflix. Like: "Watch this online here" or "order it on dvd now" . I need to speak to my US friend and ask him how this works, they havn't rolled it out in the UK yet.

Thought of a way to use imdb? They dont have an api but http://www.imdbapi.com/ performs some sort of search not sure how though.

Thanks again

jonbcampos commented 13 years ago

I've looked into imdb a few times. Sadly there isn't a solution that you can rely on there.

I definitely get what you are looking for and you can get it, its just going to be a pain. Trust me that the netflix api isn't stable all the time.

J

On Mon, Aug 1, 2011 at 6:19 PM, swagnag < reply@reply.github.com>wrote:

BOOM! Gatta say man, your code is so easy and great. The rotten tomatoes api you set us was super effective. The main reason I was thinkin of using Netflix was to offer users the possibility to see once they clicked a random movie whether they watch it over netflix. Like: "Watch this online here" or "order it on dvd now" . I need to speak to my US friend and ask him how this works, they havn't rolled it out in the UK yet.

Thought of a way to use imdb? They dont have an api but http://www.imdbapi.com/ performs some sort of search not sure how though.

Thanks again

Reply to this email directly or view it on GitHub: https://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-1705185

Jonathan Campos Dallas Flex User Group Manager http://www.d-flex.org/ blog: http://www.unitedmindset.com/jonbcampos twitter: http://www.twitter.com/jonbcampos

nitrms commented 11 years ago

Hi Jhon,

I am integrating on adobe flex mobile, however for some reason, neither result or fault event shown

here is the code

protected function application1_creationCompleteHandler(event:FlexEvent):void { //Authentication Service, to retrieve basic netflix authentication var auth:AuthenticationService = new AuthenticationService(); auth.addEventListener(NetflixResultEvent.SERVER_TIME_COMPLETE,_onAuthServiceTime_ResultHandler); auth.addEventListener(NetflixFaultEvent.FAULT,_netflixTest_faultHandler); //requests netflix token iwth developer key and secret auth.setConsumerKey(CONSUMER_KEY,CONSUMER_SECRET) auth.requestToken(); }

jonbcampos commented 11 years ago

It looks like you're only listening to the server time complete event, not the auth complete. Double check your handler and get the right event. You will want to get the server time as if the server time and the device time are too far apart then the calls will fail. This is a Netflix api issue that you'll just have to deal with.

J

On Fri, Feb 15, 2013 at 9:53 PM, geeks24 notifications@github.com wrote:

Hi Jhon,

I am integrating, however for some reason, neither result or fault event shown

here is the code

protected function application1_creationCompleteHandler(event:FlexEvent):void { //Authentication Service, to retrieve basic netflix authentication var auth:AuthenticationService = new AuthenticationService();

auth.addEventListener(NetflixResultEvent.SERVER_TIME_COMPLETE,_onAuthServiceTime_ResultHandler); auth.addEventListener(NetflixFaultEvent.FAULT,_netflixTest_faultHandler); //requests netflix token iwth developer key and secret auth.setConsumerKey(CONSUMER_KEY,CONSUMER_SECRET) auth.requestToken(); }

I am trying this on flex mobile. please guide me

— Reply to this email directly or view it on GitHubhttps://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-13642710.

Jonathan Campos

nitrms commented 11 years ago

i got it working, however how can i get list of thumb nail image and video playing in flex. this is my code for searching title. this works fine, but I want list of thumb nail image and when user clicks on it want to display video.

Tourde Flex sample is not working, when I downloaded. please guide me

var service:TitlesService = new TitlesService(); service.addEventListener(NetflixResultEvent.CATALOG_RESULT, _titleService_CompleteHandler); service.addEventListener(NetflixFaultEvent.FAULT, _netflixTest_faultHandler); //Retrieves List of Catalog Titles by Title service.getCatalogListByTitle("tom"); }

jonbcampos commented 11 years ago

Well the thumbnail is held in the CatalogItemVO box art info: https://github.com/jonbcampos/Netflix-AS3/blob/master/src/com/netflix/webapis/vo/CatalogItemVO.as

To actually run a video you have to use your app in tandem with the Netflix app. You can't run videos directly. And that is a bit of secret sauce. :) I can tell you from my apps in the past it is possible.

I'll be nice and save you a ton of research, try:

//set streaming var catalogItem:CatalogItemVO = event.value as CatalogItemVO; var imageUrl:String = catalogItem.boxArtSmall; var split:Array = imageUrl.split("/"); var fileName:String = split[split.length-1] as String; var file:String = fileName.split(".")[0] as String;

navigateToURL( new URLRequest("nflx://www.netflix.com/WiPlayer?movieid="+ file+"&returnUrl=whatever-you-want") );

On Mon, Feb 18, 2013 at 9:05 PM, geeks24 notifications@github.com wrote:

i got it working, however how can i get list of thumb nail image and video playing in flex. this is my code for searching title. this works fine, but I want list of thumb nail image and when user clicks on it want to display video.

Tourde Flex sample is not working, when I downloaded. please guide me

var service:TitlesService = new TitlesService(); service.addEventListener(NetflixResultEvent.CATALOG_RESULT, _titleService_CompleteHandler); service.addEventListener(NetflixFaultEvent.FAULT, _netflixTest_faultHandler); //Retrieves List of Catalog Titles by Title service.getCatalogListByTitle("tom"); }

— Reply to this email directly or view it on GitHubhttps://github.com/jonbcampos/Netflix-AS3/issues/1#issuecomment-13754603.

Jonathan Campos