iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.07k stars 1.78k forks source link

[Bug] Inconsistent handling of empty channel tabs #3814

Open absidue opened 1 year ago

absidue commented 1 year ago

Describe the bug A channel tab being empty is handled differently depending on the tab. The playlists tab displays nothing on the website and returns an empty API response {"playlists":[],"continuation":null}, the community tab however shows This channel hasn't posted yet on the website and returns a HTTP 500 API response with this error: {"error":"This channel hasn't posted yet"}.

It's weird that Invidious treats the playlists tab being empty as okay, but the community tab being empty as an error. The This channel hasn't posted yet is displayed on YouTube too, however Invidious happily ignores the This channel has no playlists. message on the playlists tab.

Steps to Reproduce Webpage:

  1. Visit {instance}/channel/UCUKPG1-r4WFyxpyhIuCs86Q/playlists
  2. Visit {instance}/channel/UCUKPG1-r4WFyxpyhIuCs86Q/community
  3. Compare the pages

API:

  1. Visit {instance}/api/v1/channels/UCUKPG1-r4WFyxpyhIuCs86Q/playlists
  2. Visit {instance}/api/v1/channels/UCUKPG1-r4WFyxpyhIuCs86Q/community
  3. Compare the responses

Screenshots Playlists tab: web-playlists

Community tab: web-community

SamantazFox commented 1 year ago

For the community tab, that's an "error" returned by youtube's API. In addition, the community tab still relies on older code, which hasn't been cleaned, so it isn't handled the same way as the others.

absidue commented 1 year ago

If that error is expected, does that mean you'll be returning errors for the other channel tab endpoints too or is the goal to have the community tab API endpoint behave the same as the other ones and return an empty response?

Ideally from an API user's perspective, it would be best to only return errors if there is an actual error, an empty channel tab is normal on YouTube, so shouldn't return an error. Would also align it with the behaviour of other endpoints e.g. you don't return an error when there are no search results for a search query.

SamantazFox commented 1 year ago

Yes, I agree with you here: the community endpoint shouldn't give an error if there is no posts. The plan if to return an empty array like for the other tabs.

syeopite commented 7 months ago

I'm not sure if I agree with just returning an empty array. Invidious should display some kind of message when the tab is empty instead of just having it be blank imo.

SamantazFox commented 7 months ago

@syeopite We were talking about the API. Regarding the frontend, I agree with you! Edit: And by extension, we should also show messages for no playlists/videos (in the same fashion as the "no search results" message).

ChunkyProgrammer commented 7 months ago

Playlist tab doesn't seem to be showing anymore for that channel so I guess YouTube fixed that?