Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Twitch.js (twitch.js.org)
46 points by memorable on June 7, 2022 | hide | past | favorite | 37 comments


Twitch has one of the worst developer experience I've seen. I developed a set of tools ~6 years ago and they get broken by API changes twice a year. Meanwhile my similar set of Steam tools have been running smoothly for a decade. They just love changing their APIs left and right, often without fully supporting all the previous functionality. They arbitrarily many functions harder on the developer for no reason (like how you now have to manually convert username into userid).

Also, since they switched their own internal API to GraphQL, they basically stopped caring about the developer API. That's the #1 thing, if a website doesn't use the same API that it provides developers, then chances are the API will be shit.


Could you elaborate on things Valve does right? Simple API versioning and LTS of old versions you use or more extended stuff?


Steam APIs have not significantly changed in the last 15 or so years. They're not exactly well documented, but they are relatively well understood because they haven't changed.

I'd say what they did right is simply not break existing functionality.


Exactly this. It feels like Twitch changes things for the sake of changing them. There is not reason why their changes couldn't have been backward compatible. It's just unnecessary churn for developers, who often are working for free making tools for your website.


TMI[1] is a library that serves a very similar purpose but is still actually relatively maintained (the last commit on the main release branch of twitch.js was back in late 2021 - the main branch has more recent commits but it is not a great sign there has been no releaae since late 2021)

Also TMI seems to better handle the nuances of how twitch uses IRC to provide more useful info. (Twitch uses IRCv3 tags to pass extra info on various messages[2])

[1]:https://github.com/tmijs/tmi.js

[2]: https://dev.twitch.tv/docs/irc/tags


First time I'm seeing https://js.org:

> Your page just has to provide some reasonable content with a clear connection to JavaScript! Follow these four steps to get your own free JS.ORG subdomain for your GitHub Page


Interesting how similar JS.ORG's approach is to EU.ORG (which I learned about today), in that they both provide subdomains for free.


If people are interested in this, we automatically host Twitch chat apps for you on Autocode and provide a simple, stateless API to work with Twitch chat. We host the chat infra for you, you just write serverless functions to handle webhooks / etc.

Here’s an open source app you can fork (install) immediately that gets you up and running in about a minute;

https://autocode.com/twitch/apps/basic-twitch-example/

And here’s the API Reference:

https://autocode.com/twitch/api/


> interacts with Twitch's IRC

So yet again another API without any of the features except chat. Sigh. Seriously, these IRC "APIs" barely bring anything to the table. Call it "YATICA" for "Yet Another Twitch IRC Client API" or something like that. Twitch.js suggests an API for Twitch, which this isn't. I am getting super tired of it.


You ok? It’s just a code library.

If you want someone to talk to, you can DM me on Twitter. I hope you have a nice week.


The point is that this isn't a Twitch API as the name suggests. Imagine an API for Microsoft Teams, but all it can do is ... well, chat with people. Your wouldn't call that Teams.js either, would you? At least I hope so ...


I would


This complaint seems a bit arbitrary. Twitch chat is the main interactive component of Twitch. I wouldn't be surprised to see someone build a Discord.js or Slack.js that was only good for chat bots.

It probably handles what 90% of people want to do with such a library.


tired enough of it to make your own?


Interesting that twitch still uses IRC as their messaging infrastructure. Wonder how they were able to scale it up.


Clarification: (had been stated publicly before) we speak irc as one protocol option at the edge. We are definitely not running IRC at the edge or infernally.

Source: have worked there for over 5 years.


I'm sure it's infernal.


I'm not sure if they actually use IRC internally, it could just be presenting itself as IRC to have an easy API with tons of libraries offering support. Internally, it could translate IRC calls to whatever their internal architecture wants.


At least a few years ago it was an actual IRC server and has been since justin.tv. I don’t believe they’ve changed it, as irc clients and bots have continued working with no IRC related changes. (I don’t think they’d invest in providing an IRC gateway; it’d be easier to just abandon it)


An article from late 2015 indicates that IRC is nothing more than an API interface and not their underlying system.

https://blog.twitch.tv/en/2015/12/18/twitch-engineering-an-i...


I can confirm this. Context: part of the engineering team that worked on the chat infrastructure around this time period.

The history is basically:

- v1: IRC API to process scoped servers (Python backend, haxe front end)

- kept API as we migrated backed to go (via a terrible course through nodejs); this version allowed all participants to be in a room together (ie cross process servers).

- once most of background was on go we migrated the front end (can’t remember to what)

- backend then got revved a lot (a specialized team was convened to work on chat infrastructure full time)

I left in 2017, no idea what has happened since.


I thought IRC was just an API interface to begin with? https://datatracker.ietf.org/doc/html/rfc2812


Huh, cool. Not sure when it changed but https://techcrunch.com/2007/05/22/justin-tv-network-launches... is a source for justintv using IRC


I suppose we could dig into that twitch source code leak to confirm


IRC is pretty scalable as-is, no?


It is! AFAIK you can have a bunch of relay servers effectively acting as load balancers. In the nineties / early 00s you had large IRC networks with many thousands of users chatting in real time with no issues.

Well, one known issue was a netsplit [1]. But it did work most of the time.

[1] https://en.wikipedia.org/wiki/Netsplit


They just disable WHO and don't list users in the channel. Otherwise IRC is trivial.


They do list users and provide joins and parts if you request the IRCv3 CAP. I've never used IRC before (well before my time) outside of implementing some Twitch overlay stuff for a friend though.


considering IRC has existed for 30+ years I'd hope someone has this figured out by now


Not to be confused with d-fischer's twitch.js which is now called twurple

https://github.com/twurple/twurple https://twurple.js.org/ https://d-fischer.github.io/twitch/


Great tools for peopleanaging Twitch streams.

Weird to me, there's almost no consumer facing API of note. I just want to mamage my favorite channels and categories, & the web interface is terroble- only shows like 18 results & that's all. There's no api either.

Did note, while poking around, twtich's front end is some pretty wild graphql.



Thanks for linking people the site that shows exactly what Im saying:

Many tools for running a channel, producing content,

No tools/apis for consuming/viewing. No way of managing who you follow & how you browse or experience twitch.


Ok so my knowledge of the Twitch API is apparently outdated, but there were at one point APIs that allowed for at least managing your follows.


They removed those endpoints last year[1], to help combat abuse.

[1]: https://discuss.dev.twitch.tv/t/deprecation-of-create-and-de...


Yep, I only just learned this in this thread. I went looking to see whether they had re-added follow APIs in the new API and found that deprecation notice.


typo: UNNOFICIAL -> UNOFFICIAL




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: