twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
73 stars 6 forks source link

Various Helix Endpoints return the users DisPlaYName instead of login #3

Open BarryCarlyon opened 4 years ago

BarryCarlyon commented 4 years ago

Brief description

Streams API returns the user_name as the users display_name instead.

Meaning for people building a embed from an API lookup either parse the thumbnail URL for the username, or call the users API to get the correct login name for the embed.

This is particularly a problem for "Korean" Streamers

For example

https://api.twitch.tv/helix/streams?user_id=139470326

Which returns the user_name as 한동숙 which is not valid for building a embed or channel URL

How to reproduce

Call https://api.twitch.tv/helix/streams?user_login=cohhcarnage

Expected behavior

Return "cohhcarnage" as the user_name instead of "CohhCarnage"

And/or extend the endpoint to return both

BarryCarlyon commented 4 years ago

The problem also exists with the follows endpoint

For example: https://api.twitch.tv/helix/users/follows?to_id=26610234

{
"from_id": "79645823",
"from_name": "Cochelosf",
"to_id": "26610234",
"to_name": "CohhCarnage",
"followed_at": "2019-12-06T19:44:14Z"
}

Both to_name and from_name contain the users display_name instead of the user login

BarryCarlyon commented 4 years ago

Issue also exists on live_activated_channels

{
"channels": [
{
"id": "40118378",
"username": "Chronor007",
"game": "Magic: The Gathering",
"title": "🥴 Trying new Liliana deck from Twitch Prime!🥴 [GER/EN] !sounds !sr ",
"view_count": "9218"
}
]
}
BarryCarlyon commented 4 years ago

Issues also exists on "Get Clips"

{
"data": [
{
"id": "EmpathicWildGuanacoKappaClaus",
"url": "https://clips.twitch.tv/EmpathicWildGuanacoKappaClaus",
"embed_url": "https://clips.twitch.tv/embed?clip=EmpathicWildGuanacoKappaClaus",
"broadcaster_id": "26610234",
"broadcaster_name": "CohhCarnage",
"creator_id": "17268377",
"creator_name": "KrunkSplein",
"video_id": "520874596",
"game_id": "494684",
"language": "en",
"title": "Loading Rock",
"view_count": 33,
"created_at": "2019-12-13T15:46:03Z",
"thumbnail_url": "https://clips-media-assets2.twitch.tv/AT-cm%7C583875183-preview-480x272.jpg"
}
],
"pagination": {}
}
mauerbac commented 4 years ago

HLX-1333

BarryCarlyon commented 4 years ago

Problem also exists on

BarryCarlyon commented 4 years ago

The new

https://dev.twitch.tv/docs/api/reference#get-channel-information

also has this issue, for example

{
  broadcaster_id: '23161357',
  broadcaster_name: 'LIRIK',
  broadcaster_language: 'en',
  game_id: '497440',
  game_name: 'Hell Let Loose',
  title: ':D '
}
BarryCarlyon commented 4 years ago

https://dev.twitch.tv/docs/extensions/reference/#get-live-channels-with-extension-activated

Example use case:

https://twitch.extensions.barrycarlyon.co.uk/elitetrack/

To show streamers live with my extension and link to their channel, I have to do two requests, one to live_activated then a second to users to get the login for link/embed purposes

dilizarov commented 4 years ago

@BarryCarlyon so what is the solution for generating URLS via this API: https://dev.twitch.tv/docs/api/reference#get-users?

If I'm reading correctly, display_name is not a reliable parameter (korean characters, etc. possible), so I should leverage the login parameter instead?

That is to say if I got { ..., display_name: "Display Name", login: "loginname", ... }, then I would generate the url https://twitch.tv/loginname, correct?

Essentially my use case is trying to get the URL to the authenticated user's profile.

BarryCarlyon commented 4 years ago

If I'm reading correctly, display_name is not a reliable parameter (korean characters, etc. possible), so I should leverage the login parameter instead?

Correct, the users API is the ONLY API that returns the actual login, where the login is used for URLs.

If you called the streams API, you get a list of Display Names then have to do a lookup against the users API to get the logins for construction URLs/links to channel. Two lookups where one should of suffice.

BarryCarlyon commented 4 years ago

https://dev.twitch.tv/docs/api/reference/#get-stream-markers

Returns dISPlayNAME instead of user login for the creating user of the marker

BarryCarlyon commented 4 years ago

Example use case: https://barrycarlyon.github.io/twitch_misc/examples/browse_following/

I have to do one call to get the streams of the people I follow. Then a second call to get the usernames of those people to generate a link to that stream.

BarryCarlyon commented 3 years ago

EventSub has now contracted the virus for saying "name" and sending dIsPlAy_NaMe instead

BarryCarlyon commented 3 years ago

Eventsub fixed it on eventsub \o/

BarryCarlyon commented 3 years ago

As per todays documentation and API update noted in the change log

https://dev.twitch.tv/docs/change-log

The following endpoints no longer suffer from GitHub issue 3.

GET helix/bits/leaderboard
GET helix/channel_points/custom_rewards
PATCH helix/channel_points/custom_rewards
POST helix/channel_points/custom_rewards
GET helix/channel_points/custom_rewards/redemptions
PATCH helix/channel_points/custom_rewards/redemptions
GET helix/extensions/transactions
GET helix/moderation/banned
GET helix/moderation/banned/events
GET helix/moderation/moderators
GET helix/moderation/moderators/events
GET helix/search/channels
GET helix/streams
GET helix/streams/markers
GET helix/videos
GET helix/users/follows

Most notably omitted at this time are the subscription related endpoints and extension live_activated_channels

But not longer for streams do we need to fetch users to get the username to link with! \o/

BarryCarlyon commented 3 years ago

Channel editors has the virus!

https://dev.twitch.tv/docs/api/reference#get-channel-editors

BarryCarlyon commented 2 years ago

And the new Get Extension Live Channels has it too which replaced extension live_activated_channels

https://dev.twitch.tv/docs/api/reference#get-extension-live-channels

Xemdo commented 1 year ago

Get Extension Live Channels and Get Channel Editors currently seem to be correct as per our documentation. broadcaster_name is the display name, not the user's login. The Get Extension Live Channels endpoint simply does not return the user's login, just Display Name and User ID.

Behavior likely wont change as user_name is consistent across all API endpoints. Ideally it would be called display_name instead, but since the field is already in place it would be a breaking change to rename it. Best course of action from here would be adding the field user_login to these endpoints, but that would be a UserVoice suggestion rather than a bug.