Fastest way of checking if a stream is online?

Iā€™'m trying to check which streams are online or not from a list of following channels but what I have right now is very slow. It has to load the json object from every stream link which slows it down by alot.

item = requests.get("     oauth_token=_______________________________")
loadSource = json.loads(item.text)
for item in loadSource["follows"]:
	checkOnline = requests.get("" + item["channel"]["name"])
	loadSource = json.loads(checkOnline.text)
	if loadSource["stream"] != None:
		print item["channel"]["name"]

Iā€™m getting the right list of online streams but requesting a site for every stream makes it very slow. Is there a way I can request if a list of streams at once.

The /streams endpoint is what you are looking for. You can request multiple channels at once, and only those that have an object returned are live.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.