isFakeAccount / psnawp

PlayStation Network API Python
https://pypi.org/project/PSNAWP/
Other
97 stars 21 forks source link

No more get_title_id() #80

Closed OsamaHeweitat closed 5 days ago

OsamaHeweitat commented 1 week ago

The "Implements GraphQL endpoint for the Search Class" removed the get_title_id() functionality from search.

isFakeAccount commented 1 week ago

I removed get_title_id() for a few reasons.

There are two ways of getting title id.

  1. https://andshrew.github.io/PlayStation-Titles
  2. Using search like shown below
from os import getenv

from dotenv import load_dotenv
from psnawp_api import PSNAWP
from psnawp_api.models import SearchDomain

load_dotenv()

def main() -> None:
    psn = PSNAWP(getenv("NPSSO_CODE", "NPSSO_CODE"))
    search = psn.search("Fallout 76", search_domain=SearchDomain.FULL_GAMES, limit=1)
    for result in search:
        print("Game Title Name", result["result"]["invariantName"])
        print("Content ID", result["result"]["defaultProduct"]["id"])

if __name__ == "__main__":
    main()

This will print

Game Title Name Fallout 76
Content ID UP1003-CUSA12057_00-PRJMTN0000000000

The title id here is CUSA12057_00 which you can extract easily.

OsamaHeweitat commented 1 week ago

Thank you very much, this is a good replacement.

isFakeAccount commented 1 week ago

I am reopening this issue because in the documentation there still are references to get_title_id

I'll close it when documentation is updated.

OsamaHeweitat commented 1 week ago

This will print

Game Title Name Fallout 76
Content ID UP1003-CUSA12057_00-PRJMTN0000000000

The title id here is CUSA12057_00 which you can extract easily.

Is there a way to get the full Content ID (e.g. UP1003-CUSA12057_00-PRJMTN0000000000) without using search? such as using the trophy title? if not, is it something that would be possible to implement or is this a limitation of the API?

isFakeAccount commented 5 days ago

Is there a way to get the full Content ID (e.g. UP1003-CUSA12057_00-PRJMTN0000000000) without using search? such as using the trophy title? if not, is it something that would be possible to implement or is this a limitation of the API?

@OsamaHeweitat trophyTitles endpoint does not return Title ID. Trophies use a different ID system which is called npCommunicationId. You really only need title id for one method.

https://andshrew.github.io/PlayStation-Titles/ is probably the best way to find title ids besides the search endpoint.