Twitch TV project - placeholder notification If channel doesn't exist

Twitch TV project - placeholder notification If channel doesn't exist
0

#1

Hello,

I have all the functionality of my twitch TV project working except this user story:

User Story: I will see a placeholder notification if a streamer has closed their Twitch account (or the account never existed). You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.

So I need to notify the viewer if a twitch steamer’s account doesn’t exist. So I assume that by making a getJSON request to a non-existent account, I would receive some kind of null or undefined value. But the data received from a non-existent account is the same as the data received from an offline account. They both say: ‘stream’: null

Can anyone let me know how to distinguish offline accounts from non-existent accounts so that I can finish this project?

Thank you


#3

Thanks. I had this issue as well and your hint to try other routes got me unstuck.

For those who end up on this thread with the same issue in the future, the solution is to use the ‘users’ route that the Twitch API provides in addition to the ‘streams’ route.

Documentation:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/users.md


#4

that NO LONGER works with all the Twitch changes to their API data endpoints. All user accounts that are banned are lumped in with non-existent accounts so the same data endpoint will be returned with no way to know if the account never existed, was misspelled or was banned.

I have a list of KNOWN banned users along with some misspelled accounts I ran against their API and they all returned the same endpoint.


#5

But for the context of this assignment, which doesn’t consider a user’s banned-status as a criteria, this method still works. Still, it is a helpful caveat to keep in mind that setting up the app in this way will consider banned users as closed accounts, so thanks for sharing.


#6

NOT TRUE BUDDY …

USER REQUIREMENT #6 -

  1. User Story: I will see a placeholder notification if a streamer has closed their Twitch account (or the account never existed). You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.

Req #6 cannot be validated at all.[quote=“EgoDominusVos, post:4, topic:72814, full:true”]
that NO LONGER works with all the Twitch changes to their API data endpoints. All user accounts that are banned are lumped in with non-existent accounts so the same data endpoint will be returned with no way to know if the account never existed, was misspelled or was banned.

I have a list of KNOWN banned users along with some misspelled accounts I ran against their API and they all returned the same endpoint.
[/quote]


#7

I think I see what you’re saying now. With the API at present, we can’t tell if a user account never existed or was misspelled, because the account might have existed, only now they’ve been banned and the API has no way of distinguishing. Am I following you?

Is there a way you can bring this to FreeCodeCamp’s attention? I think the remedy here is for them to update the user story. Assuming that this is just beyond what they actually care about for the assignment, I’m still going to submit my application as-is (just returning a “user not found” placeholder if the user can’t be found with a get request to the users route, even if it incorrectly does this if the user was simply banned).


#8

TwitchTv API uses 422 and 404 interchangeably with other “error” responses to calls;

404/422 could equal “Unprocessable Entity” or “Not Found” or “No Subscriptions” or “null” or “No Content” or “your name it”, their developers just lump any friggin’ error into 404 or 422 …