achievements-app / achievements-app/psn-api

Profile Pictures & Avatars

Open
#217 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
422
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Hi, I want to get the player avatars and custom profile pictures in the available sizes. I have tried some endpoints and have the following findings and a lost of questions:

**getProfileFromUserName**
```
await getProfileFromUserName(
{ accessToken: this.psnAuthTokens.accessToken },
'denniske1001',
);
```

```
{
"profile": {
"onlineId": "denniske1001",
"accountId": "4050105482827404713",
"avatarUrls": [
{
"size": "l",
"avatarUrl": "http://static-resource.np.community.playstation.net/avatar/3RD/UP43611208W01_5E8AE3139D24EE68D8A0_L.png"
}
],
"personalDetailSharing": "no",
...
}
}
```

**getProfileFromAccountId**
```
await getProfileFromAccountId(
{ accessToken: this.psnAuthTokens.accessToken },
'4050105482827404713'
);
```

```
{
"onlineId": "denniske1001",
"avatars": [
{
"size": "s",
"url": "http://static-resource.np.community.playstation.net/avatar_s/3RD/UP43611208W01_90E779569BB36140D67B_S.png"
},
{
"size": "xl",
"url": "http://static-resource.np.community.playstation.net/avatar_xl/3RD/UP43611208W01_5E8AE3139D24EE68D8A0_XL.png"
},
{
"size": "l",
"url": "http://static-resource.np.community.playstation.net/avatar/3RD/UP43611208W01_5E8AE3139D24EE68D8A0_L.png"
},
{
"size": "m",
"url": "http://static-resource.np.community.playstation.net/avatar_m/3RD/UP43611208W01_36B99D5D8BC0D8E4DF49_M.png"
}
],
...
}
```

**makeUniversalSearch**
```
await makeUniversalSearch(
{ accessToken: this.psnAuthTokens.accessToken },
'denniske1001',
'SocialAllAccounts'
);
```

```
{
"prefix": "denniske1001",
"domainResponses": [
{
...
"results": [
{
"id": "JGFwcjEkYXNka2ZqYWwkcnE4WXFyMlJrT05EV1haekh2QWUwLg==",
"socialMetadata": {
"accountId": "4050105482827404713",
"onlineId": "denniske1001",
"avatarUrl": "http://static-resource.np.community.playstation.net/avatar/3RD/UP43611208W01_5E8AE3139D24EE68D8A0_L.png",
"profilePicUrl": "https://image.api.playstation.com/profile/images/filestore/b5b41197/4050105482827404713/1755465281647.png",
...
},
...
}
]
}
],
...
}
```

Currently my favorite is **makeUniversalSearch** because it is the only one that returns both `avatarUrl` and `profilePicUrl`.

The `profilePicUrl` is btw not yet added to the return type:
https://github.com/achievements-app/psn-api/blob/798f636e03d63dad8bd56a031fa6a07111387e95/src/models/social-account-result.model.ts#L12

1. Can we make **getProfileFromUserName** and **getProfileFromAccountId** also return the `profilePicUrl`?

I see there is a field `personalDetail(@default,profilePictureUrls)` requested but not returned:
https://github.com/achievements-app/psn-api/blob/798f636e03d63dad8bd56a031fa6a07111387e95/src/user/getProfileFromUserName.ts#L30

Is that because `personalDetailSharing` is false?

2. Can we make **makeUniversalSearch** return search results for multiple `onlineId`s. Maybe a search term like `denniske1001,walter123` is possible?

3. Can we make **makeUniversalSearch** return all sizes for the avatar and profile pic? Are there even different sizes hosted for the profile pic?

4. Kind of related to 2. If I only have the `L` size of an avatar. How can I find out the urls of the other sizes. I noticed sometimes the size suffix is _uppercase_ and sometimes it is _lowercase_. Also the _folder_ avatar_(size) is different. Is there a naming schema for different types of avatars?

I also noticed the default avatar even has inconsistent sometimes 'DefaultAvatar' and sometimes 'Defaultavatar' 👀

http://static-resource.np.community.playstation.net/avatar_s/default/DefaultAvatar_s.png
http://static-resource.np.community.playstation.net/avatar_xl/default/Defaultavatar_xl.png
http://static-resource.np.community.playstation.net/avatar/default/DefaultAvatar.png
http://static-resource.np.community.playstation.net/avatar_m/default/DefaultAvatar_m.png

http://static-resource.np.community.playstation.net/avatar_s/SCEI/I0073_s.png
http://static-resource.np.community.playstation.net/avatar_xl/SCEI/I0073_XL.png
http://static-resource.np.community.playstation.net/avatar/SCEI/I0073.png
http://static-resource.np.community.playstation.net/avatar_m/SCEI/I0073_m.png

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.