3

Here's a site ( https://twitchemotes.com/apidocs ) that shows an API to get twitch emotes (basically, json describing a set of images belonging to various users).

The API looks simple enough- but they have no examples of requests. So, for this example call ( https://twitchemotes.com/api_cache/v3/subscriber.json ), it returns a huge amount of data.

How do I narrow the request to a single channel?

The website has that example URL, and an example response, but no info on how to request a single channel. So, I assume there's some common knowledge I should be drawing from to be able to derive how to do so? Unfortunately, I apparently lack this knowledge. What am I missing?

Phildo
  • 986
  • 2
  • 20
  • 36
  • You might have better luck using the official API to retrieve emotes: https://dev.twitch.tv/docs/v5/reference/chat#get-chat-emoticons-by-set – JBC Sep 18 '17 at 06:10
  • that API (v5) is deprecated, and also seems to fail on the same grounds: you can only get the actual URLs if you load a _huge_ amount of data... the new twitch API doesn't seem to even _have_ any emote-related specs... – Phildo Sep 18 '17 at 15:14
  • No, you can filter by using the `emotesets` query param; it's only large amounts of data if you opt not to use that. It's deprecated but available until the end of 2018 (15 months from now). That said, I'm not sure how you get the emoteset-to-channel mapping without querying the full data at least once and creating/saving the mapping yourself. The new API seems to have very little functionality and I don't see how to use emotes with it. – JBC Sep 18 '17 at 18:33

3 Answers3

2

You get emotes for a specific channel you need to make two requests:

  1. http://api.twitch.tv/api/channels/:channel_name/product

You can use this request to resolve the emoticon set IDs for a channel. For most channels under the plan array you will have 3 objects that each contain one or more emoticon_set_ids arrays. For most channels there will be 3 total. Some channels without 3 tier subscriptions may not have a plan array so you can look at emoticons for that instead.

(This endpoint is not designed for 3rd party use but it works and probably won't change much. Need to send Kraken client ID.)

  1. https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=:emoticon_set_list

(Kraken v3)

Take the 3 emoticon_set_ids values and append them as a comma separated list to the emotesets parameter.

I am owner of Twitchemotes and this is basically the process I use to update my index.

1

This URL can get you all of the emotes and plenty of other information:

https://api.twitch.tv/api/channels/timthetatman/product

where timthetatman is the username/login of a channel.

The emoticons property has only the first tier of emotes. You can get all of them in the plans object:

data.plans.reduce((p, n) => p.concat(n.emoticons), []);

You can get a direct URL in the emote object, but the preferred URL format would be like this:

https://static-cdn.jtvnw.net/emoticons/v1/123456/1.0

where 123456 is the emote ID and 1.0 is the scale. Scale can be 1.0, 2.0, or 3.0

let id = data.plans[0].emoticons[0].id;
let emoteURL = `https://static-cdn.jtvnw.net/emoticons/v1/${id}/1.0`;
Alca
  • 55
  • 1
  • 8
0

api.twitch.tv is gone.

You can also use this API: https://twitchemotes.com/apidocs

Ali
  • 142
  • 7