trakt-tools / universal-trakt-scrobbler

MIT License
559 stars 54 forks source link

Netflix History Sync is failing because Netflix response doesn't contain summary #202

Closed Sherloks closed 1 year ago

Sherloks commented 2 years ago

When loading my Netflix History, I receive the following message in my console

Failed to load history. TypeError: Cannot read properties of undefined (reading 'season') See: https://github.com/trakt-tools/universal-trakt-scrobbler/blob/beta/src/services/netflix/NetflixApi.ts#L332

In my case it's failing on an episode from Family Guy ("movieID": 81252762).

When looking at the response from /api/shakti/mre/pathEvaluator?languages=en-US we can see that the response for 81252762 is different than the others and the response contains an error object.

{
    "value": {
        "videos": {
            "80237931": {
                // This one is working
                "releaseYear": 2020,
                "summary": {
                    "idx": 3,
                    "id": 80237931,
                    "type": "episode",
                    "isOriginal": true,
                    "episode": 3,
                    "season": 1,
                    "isPlayable": true,
                    "$type": "leaf"
                }
            },
            "81252762": {
                // This one is failing because of missing summary element
                "releaseYear": 2019
            }
        },
        "seasons": { ... }
    },
    "error": {
        "innerErrors": [
            {
                // Error from Netflix API?
                "message": "OnError while emitting onNext value: [Lrx.Observable;.class",
                "pql": [
                    "videos",
                    [
                        81252762
                    ],
                    "summary"
                ]
            }
        ]
    }
}
RebeliusGaming commented 1 year ago

How can I correct the code? I'm getting the error