Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TV Shows seasons and episodes #64

Open
badcrc opened this issue Nov 8, 2015 · 15 comments
Open

TV Shows seasons and episodes #64

badcrc opened this issue Nov 8, 2015 · 15 comments

Comments

@badcrc
Copy link

badcrc commented Nov 8, 2015

Seems that calls to api-global.netflix.com/desktop/odp/episodes... stoped working.

I made it work again parsing html from http://www.netflix.com/title/"+seriesID, not pretty but it works.

My changes are here: https://github.com/badcrc/plugin.video.netflixbmc

I don't dare making a PR because the code isn't pretty and i'm sure there are lots of debugs still printed, etc... anyway I hope it helps!

@andrewleech
Copy link
Owner

Yeah thanks, I know the whole thing is quite broken now.
I've started down a path that's close to a complete rewrite to make the plugin faster and easier to maintain, with more consistent results for anyone who tries it.
Once I get the new structure in place I'll be needing parsing patterns like this, any mix of alternate sources to give us a complete system will be good.
It's been slow progress though with work commitments lately, been slammed. I'm hoping to move forward soon though.

@krutoileshii
Copy link

I figured out some of the calls so far. I am able to get a list of episodes in json so no need to hack through the actual HTML. Right now i am working on tracking down the images, descriptions for episodes, ratings and the watched flag. Do you have a place you would want it posted?

So far the best way to use the calls is the following:

Get Show ID->Get Show Description (Season list, Title, Number of Seasons) ->request season list (Season Name, Episode List)->get Episode Info. trying to get this into one call though at the moment to cut down the round trip.

@krutoileshii
Copy link

Take a look at the below I can likely track down the rest of the pieces for you if it will help.

I checked the current code, so far looks like you have the rest of the information. Also, IMDB might be a better source for episode descriptions and season info as well as easier to obtain.

Call to retrieve Show Information.

post method to the following URI: http://www.netflix.com/api/shakti/ebd809fd/pathEvaluator?withSize=true&materialize=true&model=harris&fallbackEsn=WWW

Note: the ebd809fd part changes depending on who you are. it can be parsed off the main page however.

Call:

   "paths":[
      [  
         "videos",
         [  
            70153404
         ],
         [  
            "availability",
            "synopsis",
            "episodeCount",
            "info",
            "maturity",
            "runtime",
            "seasonCount",
            "releaseYear",
            "userRating",
            "watched",
            "seasonList",
            "current"
         ]

      ]  
   ],

   "authURL":"1447121937288.B3WL/SujIt/5twW39Yaw/pN795o="
}

Return:

{
    "value": {
        "$size": 622,
        "size": 622,
        "videos": {
            "70153404": {
                "$size": 622,
                "size": 622,
                "availability": {
                    "isPlayable": true,
                    "$type": "leaf",
                    "$size": 29,
                    "size": 29
                },
                "info": {
                    "narrativeSynopsis": "Love, laughter and the best friends you could ask for. Just like real life. But with really nice apartments.",
                    "evidence": {
                        "type": "hook",
                        "priority": 2,
                        "value": {
                            "kind": "TvRatings",
                            "text": "This smash-hit sitcom made stars of its six leads and finished in primetime TV's top 10 every season."
                        }
                    },
                    "message": null,
                    "$type": "leaf",
                    "$size": 320,
                    "size": 320
                },
                "maturity": {
                    "rating": {
                        "value": "TV-14",
                        "maturityDescription": "Parents strongly cautioned. May be unsuitable for children ages 14 and under.",
                        "maturityLevel": 90,
                        "reasons": null
                    },
                    "$type": "leaf",
                    "$size": 165,
                    "size": 165
                },
                "runtime": {
                    "$type": "sentinel",
                    "value": null,
                    "$size": 28,
                    "size": 28
                },
                "seasonCount": 10,
                "releaseYear": 2003,
                "synopsis": "Love, laughter and the best friends you could ask for. Just like real life. But with really nice apartments.",
                "episodeCount": 235,
                "userRating": {
                    "average": 3.8860173,
                    "predicted": 2.8,
                    "userRating": null,
                    "type": "star",
                    "$type": "leaf",
                    "$size": 74,
                    "size": 74
                },
                "current": [
                    "videos",
                    "70274223"
                ],
                "watched": true
            },
            "$size": 622,
            "size": 622
        }
    },
    "paths": [
        [
            "videos",
            [
                70153404
            ],
            [
                "availability",
                "synopsis",
                "episodeCount",
                "info",
                "maturity",
                "runtime",
                "seasonCount",
                "releaseYear",
                "userRating",
                "watched",
                "seasonList",
                "current"
            ]
        ]
    ]
}

This gives you the most info to get episodes.

Next call should be the following (since we now have the episode count) which will return a json object with all of the seasons and their ID's. Still trying to figure out how to add episode count to this.

   "paths":[
      [  
         "videos",
         [  
            70153404
         ],
         [  
            "seasonList"
         ],
         [
            70153404,
            "seasonList",
            {
                "from":0,
                "to":9
            }
         ]
      ]  
   ],

   "authURL":"1447121937288.B3WL/SujIt/5twW39Yaw/pN795o="
}

Then we can just request the following for each season and get picture/description/etc for each episode

   "paths":[  
      [  
         "seasons",
         60030455,
         "episodes",
         {  
            "from":-1,
            "to":40
         },
         [  
            "summary",
            "synopsis",
            "title",
            "runtime",
            "bookmarkPosition"
         ]
      ],
      [  
         "seasons",
         60030455,
         "episodes",
         {  
            "from":-1,
            "to":40
         },
         "interestingMoment",
         "_260x146",
         "jpg"
      ],
      [  
         "seasons",
         60030455,
         "episodes",
         "summary"
      ]
   ],
   "authURL":"1447125392080.6XOcbOumZh4T0/A+H7n6lLobi9k="
}

this is way easier to parse as you get json and links to images as well at the same time which we can cache.

@andrewleech
Copy link
Owner

That looks good!
Yes I'm going to be putting a strong emphasis on finding json api's for as much as possible, we really need to avoid scraping html as much as possible.

On a related note, a google search of "netflix api shakti" does bring up some other useful looking links, like: https://gist.github.com/hubgit/2019f4a3eaaa25bcbe12

@krutoileshii
Copy link

I've been playing around with Python trying to get a standalone class to manage retrieving information. That way we could keep it separate from the actual cashing and display logic. Might be easier to use it that way and possibly connect other sites like Hulu into the same plugin at some point

@andrewleech
Copy link
Owner

Absolutely, I'm restructuring the code to work that way already. My sbs addon is set up that way and it makes the code far easier to test and maintain.

@krutoileshii
Copy link

Is it in your testing repo? I'd love to get a pull of it

@andrewleech
Copy link
Owner

No not yet, it's too early days to have anything to test. I was already working on changing the chrome/browser interactions before the netflix api stuff broke so I want to finish cleaning that up before I can really get onto the netflix comms.

Once the new structure is done I'll certainly get it online and shared, such that anyone else trying to help like you can work in the new layout to make merges easy.

@krutoileshii
Copy link

I'll try to track down anything else of use for the time being then like getting lists and stuff.

@andrewleech
Copy link
Owner

If you look back a good few pages on the forum (around page 71 I think) a
couple if us were looking at various third party aggregator sites whose
APIs could be used to get some Netflix json data, I should compile the
options into a list somewhere.
On 11 Nov 2015 3:49 pm, "krutoileshii" [email protected] wrote:

I'll try to track down anything else of use for the time being then like
getting lists and stuff.


Reply to this email directly or view it on GitHub
#64 (comment)
.

@krutoileshii
Copy link

That's the thing though, Netflix already provides about 90% of the data. images,icons,actors,directors,descriptions,ratings,watched/not watched. just need the correct API call and it's extremely small size wise and fast.

@pi-anl
Copy link

pi-anl commented Nov 11, 2015

Oh absolutely, anything that can come from Netflix is best, last I looked
it seemed some of that would require js processing as opposed to straight
json. If I finish what I'm doing with the playback engine we'll be able to
do arbitrary js processing as well though which will help.
On 11 Nov 2015 4:54 pm, "krutoileshii" [email protected] wrote:

That's the thing though, Netflix already provides about 90% of the data.
images,icons,actors,directors,descriptions,ratings,watched/not watched.
just need the correct API call and it's extremely small size wise and fast.


Reply to this email directly or view it on GitHub
#64 (comment)
.

*IMPORTANT NOTE. *If you are NOT AN AUTHORISED RECIPIENT of this e-mail,
please contact Planet Innovation Pty Ltd by return e-mail or by telephone
on +613 9945 7510. In this case, you should not read, print, re-transmit,
store or act in reliance on this e-mail or any attachments, and should
destroy all copies of them. This e-mail and any attachments are
confidential and may contain legally privileged information and/or
copyright material of Planet Innovation Pty Ltd or third parties. You
should only re-transmit, distribute or commercialise the material if you
are authorised to do so. Although we use virus scanning software, we deny
all liability for viruses or alike in any message or attachment. This
notice should not be removed.

@krutoileshii
Copy link

So far I really haven't ran into any JS being required. Does require some parsing of the page when it initially loads to get the server hex, and Shakti API reference.

Do you have a rough list of what information and actions you need? I could see which ones I can track down. Also, there is a way to control the player through JavaScript but that one would definitely require JS I think. That could be separated into an actual chrome plugin though to interact with the player through the OS layer directly.

@andrewleech
Copy link
Owner

No I'm not really sure yet.

JS player interactions are already being done, that's how I handle
remote control interactions for playback on the SBS plugin. I've got no
issue injecting/running JS on demand once the chrome window is displayed.
I'm avoiding going down the chrome plugin route again to make it easier
to keep all control code in one place.
ps. the current released addon includes my chrome plugin for playback
control.

On 12/11/2015 3:14 PM, krutoileshii wrote:

So far I really haven't ran into any JS being required. Does require
some parsing of the page when it initially loads to get the server
hex, and Shakti API reference.

Do you have a rough list of what information and actions you need? I
could see which ones I can track down. Also, there is a way to control
the player through JavaScript but that one would definitely require JS
I think. That could be separated into an actual chrome plugin though
to interact with the player through the OS layer directly.


Reply to this email directly or view it on GitHub
#64 (comment).

@krutoileshii
Copy link

I am working on getting the following calls nailed down:

  • Searching (Show/Movie) - Working (also can do actors)
  • Listing Seasons - Working
  • Listing Episodes - Working
    • Getting Description - For Episodes Working
    • Getting Images - For Episodes
    • Episode Descriptions - Same as above
    • Length
    • Rating - Works
  • Actors
  • Directors
  • Category List - Works
  • User Lists - Not working yet
  • Adding Item to MyList
  • Listing Related Items (similar to what Netflix provides)

Currently just compiling a giant file with calls/replies and what's required. I will share it once it gets closer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants