Is there a way to embed twitch on your site so that only the most viewed streamer plays?

Good job! Glad to see you got it working. Just a couple of notes:

  1. The API response will already be ordered by number of viewers, so you can just select the first element in the array
  2. You check for stream == null, but I believe it can also just be an empty array? Maybe this is type coercion saving you here. I wouldn’t recommend relying on it.
  3. There’s no need to iterate over the fallback API response either. Just select the first element.