-
Notifications
You must be signed in to change notification settings - Fork 22
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Can I get the game box art cover from this api? #28
Comments
You can, with the help of If you use the stable version. You can get all the images using this code game_details = psnawp.search().get_title_details(title_id="PPSA08330_00")
details = game_details[0]
for image in details['media']['images']:
img_data = requests.get(image.get('url'))
filename = f"{image.get('type')}.png" if ".png" in image.get('url') else f"{image.get('type')}.jpg"
with open(filename, 'wb') as fp:
fp.write(img_data.content) I have moved this function from the search class to another class. And in future releases this code will work game_title = psnawp.game_title("PPSA08330_00")
details = game_title.get_details()[0]
for image in details['media']['images']:
img_data = requests.get(image.get('url'))
filename = f"{image.get('type')}.png" if ".png" in image.get('url') else f"{image.get('type')}.jpg"
with open(filename, 'wb') as fp:
fp.write(img_data.content) The work is almost done. I need to write test cases. You can install it directly from pip using pip install "git+https://github.com/isFakeAccount/psnawp.git@trophy_support" This will have trophy support but expect a few bugs. |
Here's the thing about this code or should I say programming language. Because I am actually building a react native app and I am trying to see if it's possible to get the game cover image from a psn api call. I can see translating some of this code to javascript, but I am not sure if it will work. |
Actually can I pull this api from postman or it's not compatible with it? |
All the endpoints are here https://github.com/isFakeAccount/psnawp/blob/trophy_support/src/psnawp_api/utils/endpoints.py Looks like the endpoint for getting the details is You can check this class on how to get access_token/refresh token from npsso code. You basically get a URL like https://image.api.playstation.com/vulcan/ap/rnd/202109/2821/SZRc7OMwGgv8lJXIOlYyuBU2.jpg, which you should be able to easily embed or download. |
Got it! Thank you for these wonderful resources! I am trying to get a list of titles from my profile account, I am using the examples you have with this as my base url "profile_uri": "https://m.np.playstation.com/api/userProfile/v1/internal/users" and this as my endpoint "profiles": "/{account_id}/profiles". The issue I am having with this api call is that it doesn't give me a list of game titles for my profile. I have tried using different api call but none of them give my profile game titles. |
The api call for that one I mention only gave me, |
Actually nevermind I found it with using this url: https://m.np.playstation.com/api/trophy/v1/users/{account_id}/trophyTitles but the issue I am having with this one is that it gives me trophytitleiconurl but not the game cover. Is there a way I can get the cover art within my profile list of games? Like the one you showed me with this link? |
No. You have to use the endpoint I mentioned above to get the cover. You can use the endpoint for universal search get the title id or vist this website |
How does universal search work? I tried placing the https://m.np.playstation.com/api/search/v1/universalSearch and then the search endpoint ({title_id}/concepts), but I get this message saying no permission. |
@darias08 My guess is that something is wrong with your authentication process. Have you looked at how I do authentication? |
Ok I think I know what's the issue. The You need to pass the query params as part of payload. Check the search.py file in master branch and it will make sense. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi,
I am wondering if this api can pull the box art cover of a game? Like if I want to get this as a cover for a game. Would that be possible or this api can't pull cover images.?
The text was updated successfully, but these errors were encountered: