Outdated script no longer works

The migration guide in the docs gives you all the information you need to switch from using v3 to the v5 endpoints: https://dev.twitch.tv/docs/v5/guides/migration

Keep in mind though that v5 is deprecated and will be removed at some point too, so ideally should rewrite your code to work with the Helix streams endpoint: https://dev.twitch.tv/docs/api/reference/#get-streams