achievements-app / psn-api

A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
https://psn-api.achievements.app
MIT License
263 stars 31 forks source link

getRecentlyPlayed does not brings the game if it's part of a collection #168

Closed leandroSalesCotrim closed 1 month ago

leandroSalesCotrim commented 1 month ago

In case you played some game that it's part of a bundle like Devil May Cry HD Collection or NARUTO SHIPPUDEN™: Ultimate Ninja® STORM TRILOGY, the game specific game that you played from the bundle does not apears in the return, this function just brings the collection info.

pacMakaveli commented 1 month ago

@leandroSalesCotrim there's no way to do this because the API doesn't report the Collection as individual games. Correct me if I'm wrong but neither the console, nor the PS App show this as separate games, do they?

leandroSalesCotrim commented 1 month ago

i understand, but in PS4 (probably ps5 and ps app too) i can see exactly the same list retrieved in my profile, but when i click in a game that is a bundle/collection, it bring me the trophy list of all games from the bundle, it seems that only don't bring me the games that i didn't started from collection, so it doesn't show in the bundle list. I thought this information was in API too, but if doesn't, it should be something internal data from sony that's not in the api or part from their algorithm

pacMakaveli commented 1 month ago

In that case you're probably looking for titles, rather than games. The API has 2 endpoints, trophyTitles and games.

https://m.np.playstation.com/api/trophy/v1/users/6462910331343535058/trophyTitles this should spit individual trophy lists while this https://m.np.playstation.net/api/gamelist/v2/users/6462910331343535058/titles?limit=300&offset=0 will give you the bundle, most likely.

The mapping will have to be handled by you though, as I'm not aware of the API providing this. It should be fairly trivial though.

I've done this on games.directory ( apologies for the plug ) . You need to use npCommunicationId and title_id to map them.

leandroSalesCotrim commented 1 month ago

Thanks!! i didn't knew about the gamelist endpoint, this will help me a lot to map in my project!