502 Bad Gateway on API call

If you are query Twitch channels then you should probably use the Kraken API: https://github.com/justintv/Twitch-API/blob/master/v2_resources/streams.md#get-streams