Comments (11)
You can, with the help of get_details
method. Depending on what psnawp version you are using this may vary a little.
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.
from psnawp.
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.
from psnawp.
Actually can I pull this api from postman or it's not compatible with it?
from psnawp.
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 https://m.np.playstation.com/api/catalog/v2/titles/{title_id}/concepts
You can check this class on how to get access_token/refresh token from npsso code.
https://github.com/isFakeAccount/psnawp/blob/trophy_support/src/psnawp_api/core/authenticator.py
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.
from psnawp.
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.
from psnawp.
The api call for that one I mention only gave me,
my online id, profile pictures, about me, avatar and that's it.
from psnawp.
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?
https://image.api.playstation.com/vulcan/ap/rnd/202109/2821/SZRc7OMwGgv8lJXIOlYyuBU2.jpg
from psnawp.
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
https://andshrew.github.io/PlayStation-Titles/
from psnawp.
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.
from psnawp.
@darias08 My guess is that something is wrong with your authentication process. Have you looked at how I do authentication?
from psnawp.
Ok I think I know what's the issue. The {title_id}/concepts
is not part of search endpoint.
You need to pass the query params as part of payload. Check the search.py file in master branch and it will make sense.
from psnawp.
Related Issues (20)
- aboutMe doesn't work HOT 3
- Searching PS3 and PSVita Video Games using Universal Search endpoint. HOT 10
- [Solved] Possible Issue with Authentication with PlayStation: Something went wrong while authenticating HOT 3
- Unsupported PlatformType HOT 3
- Support for Languages HOT 1
- N00b here ๐๏ธclient.title_stats() Question HOT 2
- search question HOT 7
- Is there any way to use this and have access to the PSN Store and add or checkout avatars? HOT 5
- download photo from messages HOT 3
- `get_groups` not working HOT 3
- Is it possible to learn all of my PSN account nickname history? HOT 1
- requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url HOT 5
- Is creation date possible? Suggestion HOT 1
- profile colour HOT 2
- PSNAWPNotFound from a TrophyIterator on PS5 games HOT 6
- Add Endpoint to remove player from Groups endpoint
- Add method to Remove friends
- Add Rate Limiter to the Library to make it more accessible
- Is the API down? HOT 1
- No more get_title_id() HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psnawp.